Question Suppose that the number of typographical errors on a single page of this
book has a Poisson distribution with parameter \(\lambda = 1\). Calculate the probability that there is
at least Sone error on this page.
This is a problem that has a straightforward calculation. In addition to solving the problem, we will also do a
simulation to get a realization of the mean reaching \(\lambda\) in the long run. Also trying some cool
visualizations here 😉
We need the probability that the number of errors is at-least one. \[P\{X \ge 1\} = 1 - P\{X = 0\} = e^{-\lambda} \frac{\lambda^{x}}{x!}\]
In each of the squares, the thin horizontal lines are the number of events that happened in that second. The red line tracks mean as the events accumulate. See how the mean reaches the equilibrium gradually (even though they start out in a rugged manner).
plot[] := Module[{poisson, sample = 500, movingProbability, scale = 0.001},
poisson = RandomVariate[PoissonDistribution[1], sample];
movingProbability = Transpose[{Reverse[Accumulate[poisson]/Range[sample]], scale*Range[sample]}];
Graphics[{
Table[{Opacity[0.1], Line[{{0, scale*r}, {poisson[[r]], scale r}}]}, {r, 1, sample}], {Red, Line[movingProbability]}},
ImageSize -> 240,
AspectRatio -> 1,
Frame -> True,
FrameTicks -> {Automatic, None},
PlotRange -> {{0, 6}, All}]
]
plot[number_] := Parallelize[Table[plot[], number]]
Export[StringReplace[NotebookFileName[], ".nb" -> ".svg"], GraphicsGrid[Partition[plot[30], 3]], ImageSize -> 754, ImageResolution -> 600]