Visualize an Urn Model with Weighted Balls
An urn contains 10 red balls of weight 1 and 15 blue balls of weight 2. With 12 balls drawn independently, the probability of drawing a red or blue ball depends on its weight. The number of red balls drawn has a FisherHypergeometricDistribution. The red/blue chart represents 20 simulations of this situation.
𝒟 = Block[{m1 = 10, m2 = 15, n = 12, w1 = 1, w2 = 2}, FisherHypergeometricDistribution[n, m1, m1 + m2, w1 / w2]];sample = RandomVariate[𝒟, 20];DiscretePlot[PDF[𝒟, x], {x, 0, 12}, PlotStyle -> Hue[.4, .9, .6], BaseStyle -> {FontFamily -> "Verdana"}, PlotLabel -> 𝒟, ExtentSize -> 2 / 3, ImageSize -> 400, Epilog -> Inset[BarChart[Transpose[{sample, 12 - sample}], ChartLayout -> "Stacked", Ticks -> {False, True}, ChartStyle -> {Lighter[Red, 0.5], Lighter[Blue, 0.5]}, ImageSize -> 200], {Right, 0.3}, {Right, Top}]]