Removing people who recovered on this timestep from the potentially diagnosed pool fixes the sensitivity test
@@ -256,7 +256,7 @@ class InterventionTests(CovaSimTest):
)
pass
- def test_test_prob_sensitivity(self, subtract_today_recoveries=False):
+ def test_test_prob_sensitivity(self, subtract_today_recoveries=True):
self.is_debugging = False
params = {
SimKeys.number_agents: 5000,
@@ -277,7 +277,7 @@ class InterventionTests(CovaSimTest):
self.run_sim()
first_day_diagnoses = self.get_full_result_channel(
channel=ResultsKeys.diagnoses_at_timestep
- )[start_day + 1]
+ )[start_day]
target_count = self.get_full_result_channel(
channel=ResultsKeys.symptomatic_at_timestep
)[start_day]
@@ -287,10 +287,12 @@ class InterventionTests(CovaSimTest):
)[start_day]
target_count = target_count - recoveries_today
ideal_diagnoses = target_count * sensitivity
+
standard_deviation = sqrt(sensitivity * (1 - sensitivity) * target_count)
# 95% confidence interval
min_tolerable_diagnoses = ideal_diagnoses - 2 * standard_deviation
max_tolerable_diagnoses = ideal_diagnoses + 2 * standard_deviation
+
if self.is_debugging:
print(f"\tMax: {max_tolerable_diagnoses} \n"
f"\tMin: {min_tolerable_diagnoses} \n"
