This applet models Pólya's urn experiment. An urn initially contains \(a\) red and \(b\) green balls. On each trial, a ball is selected at random from the urn, and then replaced along with \(c\) new balls of the same color. In this simulation, the red balls are numbered consecutively \((1, 2, \ldots)\) and the green balls are numbered consecutively in the same manner. The sample of balls in \(n\) trials is shown in the left graph box. Random variable \(Y\) gives the number of red balls selected after \(n\) trials, and \(M\) gives the proportion of red balls selected in the \(n\) trials. These are recorded on each update in the data table.
The probability density function and moments of \(Y\) are shown in blue in the distribution graph and are recorded in the distribution table. On each update, the empirical density function and moments of \(Y\) are shown in red in the distribution graph and are recorded in the distribution table. The parameters \(a\), \(b\), \(c\), and \(n\) can be varied with the input controls.