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 \(\lambda\). 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


Simulations

Approach to the simulations for this problem



    ClearAll[genderDivide]

    genderDivide[n_, p_: 0.5] :=
     Module[{genderDivide =
        RandomChoice[{p, 1 - p} -> {0, 1}, n]}, {Count[genderDivide, 0],
       Count[genderDivide, 1]}]

    Table[
     Module[{plot},
      plot = BarChart[
        Plus @@@
         GatherBy[
          genderDivide[#, p] & /@
           Sort@RandomVariate[PoissonDistribution[5], 10000],
          Total@# &],
        ChartLayout -> "Stacked",
        LabelingFunction -> (Placed[Rotate[#, 90 \[Degree]], Above] &),
        Frame -> True,
        PlotLabel -> Style["Probability for females = " <> ToString@p, 20],
        FrameLabel -> (Style[#, 15] & /@ {"Stacked Counts",
            "Total number of people"}),
        ImageSize -> 788, ChartLegends -> {"Female", "Male"}];
      Export[StringReplace[NotebookFileName[],
        ".nb" -> "_stacked_chart_" <> ToString[Round[10 p]] <> ".svg"],
       plot,
       ImageSize -> 1000, ImageResolution -> 800]
      ]
     , {p, 0.1, 0.9, 0.1}]


Theoretical Probabilities with Special Cases

Full Code