### The Proportion Test Experiment

Sampling Distribution
Test Distribution
Reject Distribution

#### 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 scroll bars.

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

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$$. Random variable $$Z$$ is the corresponding standard score. 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 red in the first graph. The sample proportion $$M$$ is shown in red in the first graph and the value of the test statistics ($$Y$$ or $$Z$$) is shown in red in the second graph. The variable $$I$$ indicates the event that the null hypothesis is rejected. On each run, $$Y$$, $$M$$, $$Z$$, and $$I$$ are recorded in the record table. Note that the null hypothesis is rejected ($$I = 1$$) if and only if the test statistic falls outside of the critical values. Finally, the empirical probability density function of $$I$$ is shown in red in the last graph and recorded in the distribution table.