One statistics problem about Poisson distribution

Wencao Yang
1 min readSep 23, 2020

--

Imagine you are working with a hospital. Patients arrive at the hospital in a Poisson Distribution, and the doctors attend to the patients in a Uniform Distribution. Write a function or code block that outputs the patient’s average wait time and the total number of patients that are attended to by doctors on a random day.

We can use Scipy, or we can generate it with inverse CDF or rejection sampling.

Poisson distribution

P(x = K) = exp(-lambda)*lambda^K/K!

where lambda is the expectation of the number of events

The time interval between two events follows the exponential distribution

lambda*exp(-lambda)

so we don’t need to generate Poisson distribution, just use exponential distribution to simulate the patient_i came in at time t_i.

The doctors attend to the patients in a Uniform Distribution

The doctor is available in a uniform fashion that means we can generate doctor_i with a uniform distribution

And basically, it’s done now. Just simulate and calculate the average waiting time.

Is there an analytic solution? I’ll leave it to you.

--

--

Wencao Yang
Wencao Yang

Written by Wencao Yang

Data Scientist & Physics PhD

No responses yet