# Average of random variables from two Poisson distributions?

조회 수: 7(최근 30일)
Jonne Klockars 2022년 11월 5일
댓글: Jonne Klockars 2022년 11월 6일
I'm lost with a very simple question of finding the average of random variables from two Poisson distributions. I know that if X ~ Pois(L1) and Y ~ Pois(L2), then X+Y ~ Pois(L1+L2).
I have a queue open for nine hours daily with an average of four persons in it every given minute for seven hours and an average of 20 persons in it every given minute for two hours. So I can't simply pair the X from four persons per minute with Y from 20 persons per minute. I suppose I could pair two hours of X ~ Pois(4) and two hours of Y ~ Pois(20) and simulate 240 samples with poissrnd(24) to get the number of persons in the queue for each minute of 4/9 hours but I don't know what would I do with the remaining five hours of X ~ Pois(4)? Maybe I could pair four hours of X ~ Pois(4) with four hours of Z = X+Y ~ Pois(24) and simulate 480 samples with poissrnd(28) but that would leave me one remaining hour of X ~ Pois(4). Would it be correct to take 480 samples with poissrnd(28) and then simply add 60 samples with poissrnd(4)?
After finding out how to simulate the samples I take the average of them. The question is, how do I simulate the random samples representing the number of people in the queue during the day with this information? Is mean( 480*poissrnd(28) + 60*poissrnd(4) ) what I am looking for? Assumption is, that Poisson distribution is the right one for the job so I'll use that.
##### 댓글 수: 7표시숨기기 이전 댓글 수: 6
Jonne Klockars 2022년 11월 6일
@Jeff Miller Your first comment is a solution, I overcomplicated things

댓글을 달려면 로그인하십시오.

### 채택된 답변

David Goodmanson 2022년 11월 6일
편집: David Goodmanson 2022년 11월 6일
Hi Jonne,
I assume you want to look at the distribution for a period of one minute, whenever that might occur. As opposed to looking at the distribution over longer observation periods.
There are two poisson pdfs, pdf1 and pdf2. The overall pdf will be f1*pdf1 + f2*pdf2, where f1 is the probability of partaking in the 7 hours of pdf1, and f2 is the probability of partaking in the two hours of pdf2 Here f1+f2 = 1. So this is going to depend on how you pick the weights f1, f2. There appear to be two main possibilities:
With a time average, you look at the queue at some random minute in the nine hour period, so
pdf = (7/9)*pdf1 + (2/9)*pdf2.
On the other hand, the expected number of people in the 7 hour period is 7*60*4 = 1680, and the expected number of people in the 2 hour period is 2*60*20 = 2400. The expected number of people in any minute is much larger in the two hour period, let's say due to people getting off work or whatever the factors might be. So let's say you want to find the pdf if you personally walk down Electric Avenue and get into a queue, having been influenced by those same factors. Now f1 and f2 are people weighted rather than time weighted, and
pdf = (1680/4080)*pdf1 + (2400/4080)*pdf2
Of course the expected number of people and the actual number of people are not always the same, there is a distribution for that, but in the main I think the calculation above is reasonably accurate.
##### 댓글 수: 1표시숨기기 없음
Jonne Klockars 2022년 11월 6일
Thank you very much for helping me out. The time-weighted version seems to give nice results so I'll go with that.

댓글을 달려면 로그인하십시오.

### 범주

Find more on Poisson Distribution in Help Center and File Exchange

R2022a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by