I need some help on understanding how to calculate rate of occurrence per day or probability per day. If we know that almost 5% of the patients develop infection in general, how can we use this information to estimate rate of occurrence or probability per day?

Assuming I have N number of patient per day and I want to randomly convert some of them to infected based on given probability p. The way I am doing is that I am calling the below function per day and in this function, I am looping over all the patients and for every patient, I am doing a Bernoulli trial with the probability p to see if patient got infected or not. I am using Python.

trial = self.get_bernoulli_trial(p) 

def get_bernoulli_trial(self, p):
        return np.random.binomial(1, p)

If trial returns 1, I make that patient infected otherwise do nothing.

So the question is, is this a right way of doing this and how to estimate p per day for Bernoulli trial from the knowledge that 5% patients on average develop infection. If I use p = 0.05, would that be correct?

Any help will be appreciated.

  • $\begingroup$ If you know that p=5% what is there to estimate? $\endgroup$ – Tim Jan 6 '20 at 13:31
  • $\begingroup$ Question is would it be correct to use p = 5% per day from the estimate that on average 5% gets infected. And I do not know anything about the time period of the general estimate. Or may be I am just confused and there is nothing to estimate. $\endgroup$ – Tim Jan 6 '20 at 13:51
  • $\begingroup$ I am just confused in converting probability from an unknown time period to probability per day. $\endgroup$ – Tim Jan 6 '20 at 13:52

With your description, and code, you seem to assume that the infections are independent Bernoulli trials with same probability of infection $p$. In such case, since they are independent, it does not matter if you group them in days, or look at the global incidence, the probability remains the same. For each of the patients, independently, it is $p=0.05$ by definition.

Of course, this does not (and probably isn't) a realistic assumption. I guess that it could be possible that such events are clustered at time, for example, if there is an influenza outbrake, the probability of observing such patient gets large, but few months later it gets much smaller. However, to estimate such changes over time, you would need to know much more details, and have adequate temporal data. You cannot de-aggregate the single total number to learn about such variability.


$Binom(1, p)$ is not an appropriate function to use for generation, as the samples are drawn without replacement from a fixed pool of patients.

If you know that 5% of however many patients you have will be infected and you are interested in simulating whether any individual patient gets sick, you can use

$$p(sick) = Hypergeom(Total\ patients,Expected\ sick,Already\ added)$$

as the Bernoulli probability where $Expected$ is a sample from $Binom(Total, p)$ (where p=0.05 in this case), and $Added$ is the number of patients you rolled for so far plus one (you'd need to keep track of every patient that rolled a success as you set them as infected).

So for example, if the first patient out of 100 would use $Hypergeom(100, 5, 1)$, the second $Hypergeom(100, 5, 2)$ and so forth.

If you're not quite certain of the fraction, you can go one further back, and draw the $p$ in Binominal from a Beta distribution with the count of the infected patients and total patient count as parameters.

  • $\begingroup$ Why would it be a "fixed pool of patients"?! It is not that there is a fixed pool of people, some sick, some not, and you are drawing some of them from the pool. Any of the people can randomly get ill. Moreover a person may one day be healthy and ill another day, this is a direct form of "replacement". This scenario is closer to sampling "with replacement". I see no reason for assuming hypergeometric distribution unless you could give more detailed rationale for it. $\endgroup$ – Tim Jan 6 '20 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.