Proportion Test Experiment

Description

The experiment is to select a random sample of size \(n\) from the Bernoulli distribution with parameter \(p\), and then test a hypothesis about \(p\) at a specified significance level. The sample size \(n\), the true value \(p\), the significance level \(\alpha\), and the boundary point \(p_0\) between the null and alternative hypotheses can all be varied with a scrollbars.

The type of test: two-sided, left-sided, or right-sided can be selected from a list box. The Bernoulli probability density function, \(p\) and \(p_0\) are shown in the first graph.

Random variable \( Y \) denotes the number of successes in the \( n \) trials. Under the assumption \( p = p_0 \), \( Y \) has the binomial distribution with parameters \( n \) and \( p_0 \). The corresponding standard score is \[ Z = \frac{Y - n p_0}{\sqrt{n p_0 (1 - p_0)}} \] Under the same assumption, and if \( n \) is large, \( Z \) has approximately a standard normal distribution. Either the binomial test with test statistic \( Y \) or the approximate normal test with test statistic \( Z \) can be chosen with the list box. The distribution of the test distribution and the critical values are shown in the second graph in blue.

On each run, the sample probability density function is shown in the first graph and the value of the test statistics (\( Y \) or \(Z\)) is shown in the second graph. The indicator variable \(R\) indicates the event that the null hypothesis is rejected. The empirical probability density function of \(R\) is shown in the third graph. On each run, \( Y \), \(M\), \(Z\), the \(P\)-value, and \(R\) are recorded in the data table. Note that the null hypothesis is rejected (\(R = 1\)) if and only if the test statistic falls outside of the critical values.