### The Variance Test Experiment

#### Description

The experiment is to select a random sample of size \(n\) from a selected distribution and then test a hypothesis about the standard deviation \(\sigma\) at a specified significance level. The distribution can be selected from a list box; the options are the normal, gamma, and uniform distributions. In each case, the appropriate parameters and the sample size \(n\) can be varied with input controls.

The significance level can also be selected with an input control. The type of test: two-sided, left-sided, or right-sided. can be selected from a list box. The boundary point \(\sigma_0\) between the null and alternative hypotheses can be varied with an input control. The probability density function of the distribution, as well as \(\mu\) and \(\sigma\), and \(\sigma_0\) are shown graphically.

The test can be constructed under the assumption that the distribution mean \( \mu \) is known or unknown. In the first case, the test statistic \( U \) is based on a special version \( W^2 \) of the sample variance, and has the chi-square distribution with \(n\) degrees of freedom. In the second case the test statistic \( V \) is based on the standard version \( S^2 \) of the sample variance, and has the chi-square distribution with \(n - 1\) degrees of freedom. The probability density function and the critical values of the test statistic are shown in the second graph in blue.

On each update, the sample density function is shown in red in the first graph and the sample values are recorded in the sample table. The value of the test statistic is shown in red in the second graph. Random variable \(R\) indicates the event that the null hypothesis is rejected. On each run, either \(S^2\), \(V\), and \(R\) are recorded in the data table, or \( W^2 \), \( U \) and \( R \) are recorded (depending on whether \( \mu \) is unknown or known). Note that the null hypothesis is rejected (\(R = 1\)) if and only if the test statistic falls outside of the critical values. Finally, the empirical density function of \(R\) is shown in red in the last graph and recorded in the last table.