Modified total probability rule formula
This commit is contained in:
parent
7a9401a6fa
commit
f7b63decc3
2 changed files with 9 additions and 7 deletions
|
|
@ -439,7 +439,7 @@ class Virus:
|
|||
#: Pre-populated examples of Viruses.
|
||||
types: typing.ClassVar[typing.Dict[str, "Virus"]]
|
||||
|
||||
#: Number of incubation days
|
||||
#: Number of days the infector is contagious
|
||||
infectiousness_days: int = 14
|
||||
|
||||
def halflife(self, humidity: _VectorisedFloat, inside_temp: _VectorisedFloat) -> _VectorisedFloat:
|
||||
|
|
@ -1482,10 +1482,12 @@ class ExposureModel:
|
|||
exposure_model = nested_replace(
|
||||
self, {'concentration_model.infected.number': num_infected}
|
||||
)
|
||||
prob_exposed_occupant = exposure_model.infection_probability().mean() / 100
|
||||
# By means of a Binomial Distribution
|
||||
sum_probability += (prob_exposed_occupant *
|
||||
self.geographical_data.probability_meet_infected_person(self.concentration_model.infected.virus, self.exposed.number, num_infected))
|
||||
prob_ind = exposure_model.infection_probability().mean() / 100
|
||||
exposed_ind = self.exposed.number
|
||||
# By means of the total probability rule
|
||||
prob_at_least_one_infected = 1 - (1 - prob_ind)**(exposed_ind-1)
|
||||
sum_probability += (prob_at_least_one_infected *
|
||||
self.geographical_data.probability_meet_infected_person(self.concentration_model.infected.virus, exposed_ind, num_infected))
|
||||
return sum_probability * 100
|
||||
else:
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -276,9 +276,9 @@ def test_prob_meet_infected_person(pop, cases, AB, exposed, infected, prob_meet_
|
|||
@pytest.mark.parametrize(
|
||||
"population, cm, pop, cases, AB, probabilistic_exposure_probability",[
|
||||
[populations[1], known_concentrations(lambda t: 36.),
|
||||
100000, 68, 5, 27.537276],
|
||||
100000, 68, 5, 38.594805],
|
||||
[populations[0], known_concentrations(lambda t: 36.),
|
||||
100000, 68, 5, 23.540145],
|
||||
100000, 121, 2, 29.138216],
|
||||
])
|
||||
def test_probabilistic_exposure_probability(population, cm,
|
||||
pop, AB, cases, probabilistic_exposure_probability):
|
||||
|
|
|
|||
Loading…
Reference in a new issue