# Sheldon Ross 10: Example 3.23 Question: Suppose that the number of people who visit a yoga studio each day is a Poisson random variable with mean λ. Suppose further that each person who visits is, independently, female with probability p or male with probability  1−p. Find the joint probability that exactly n women and m men visit the academy today.

Solution: Dissecting the problem. I will try giving a brief explanation of the solution here. For a high detail of the problem, please refer to the text

• Notice that there a constraint on the sum itself but n and m themselves could be variables given that they add up-to a number
• The probability that we need can be denoted as follows
• P{N1=n, N2=m} = Σ P{N1=n, N2=n | N = i} P{N=i}
• Then, the probability that P{N=i} is poisson distribution e λn+m(n+m)!
• since there are two components to the poisson count, we need to introduce a binomial here and simplifying them we get two probabilities as
• P{N1=n} = e-λp (λp)nn!
• P{N2=m} = e-λ(1-p) (λ(1-p))mm!

Simulations: Approach to the simulations for this problem

• Pick an arbitrary λ for the Poisson Random Variate. Here I have chosen λ = 5
• The poisson outputs are numbers or the total number of people (male and female) visiting the yoga studio on a given day
• Pass these numbers into a function that divides the number into males and females
• For example, if the total number of people visiting the studio is 6, then this function would give the following combinations
• 0-Females & 6-Males
• 1-Females & 5-Males
• 2-Females & 4-Males
• 3-Females & 3-Males
• 4-Females & 2-Males
• 5-Females & 1-Males
• 6-Females & 0-Males
• Then, we need to reformat the data to match the input format for the BarChart
• All the above has been done in code that has been presented below the charts        Theoretical Probabilities with Special Cases

• In the animations that follow, I have fixed the λ to be 25.
• Then, I have examined the cases where the total number of people is 20.
• This means that the 20 people could be formed from any one of the following cases
• Nfemales = 0 and Nmales = 20
• Nfemales = 1 and Nmales = 19
• Nfemales = 2 and Nmales = 18
• Nfemales = 3 and Nmales = 17
• Nfemales = 4 and Nmales = 16
• Nfemales = 5 and Nmales = 15
• Nfemales = 6 and Nmales = 14
• Nfemales = 7 and Nmales = 13
• Nfemales = 8 and Nmales = 12
• Nfemales = 9 and Nmales = 11
• Nfemales = 10 and Nmales = 10
• Nfemales = 11 and Nmales = 9
• Nfemales = 12 and Nmales = 8
• Nfemales = 13 and Nmales = 7
• Nfemales = 14 and Nmales = 6
• Nfemales = 15 and Nmales = 5
• Nfemales = 16 and Nmales = 4
• Nfemales = 17 and Nmales = 3
• Nfemales = 18 and Nmales = 2
• Nfemales = 19 and Nmales = 1
• Nfemales = 20 and Nmales = 0
• We will look at these for the probability values from 0.1 to 0.9 in steps of 0.1
• so the probabilities would be {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}

Code —————————— End of the post

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.