# How can one find $g$ so that the test will have size $\beta$?

I have the random sample $$Y_1, Y_2, \dots, Y_n$$ drawn from $$\text{Normal}(\mu, \sigma^2)$$, where $$-\infty < \mu < \infty$$ and $$0 < \sigma^2 < \infty$$. To test the null hypothesis $$H_0 : \sigma^2 = 1$$ against the alternative hypothesis $$H_1 : \sigma^2 > 1$$, we have the test

$$\text{Reject} \ H_0 \ \ \ \text{if} \ \ \ S^2 > g,$$

where $$S^2 = \dfrac{1}{n - 1} \sum\limits_{i = 1}^n \left( Y_i - \bar{Y} \right)^2$$, $$g$$ is a constant. We can see that $$(n - 1)\dfrac{S^2}{\sigma^2}$$ has a $$\chi^2_{n - 1}$$ distribution with $$n - 1$$ degrees of freedom.

How can one find $$g$$ so that the test will have some size $$\beta$$?

It is best to use standard notation, so I will use $$\alpha$$ to denote the size of the test. Under the null hypothesis, you have the distribution:

$$(n-1)S^2| H_0 \sim \text{ChiSq}(n-1).$$

Let $$F$$ denote the distribution function and $$Q = F^{-1}$$ denote the quantile function of the chi-squared distribution with $$n-1$$ degrees-of-freedom. Using the size level $$\alpha$$ for the test we have:

$$\alpha = \mathbb{P}(S^2 > g| H_0) = \mathbb{P}((n-1)S^2 > (n-1)g| H_0) = 1-F((n-1)g).$$

Some simple algebra then gives:

$$g = \frac{Q(1-\alpha)}{n-1}.$$

We can compute this cut-off value in R using the following code. Here we will create a general function cutoff.vartest to compute this value, and we use this to compute an example of the cut-off value when we use $$n=100$$ and $$\alpha=0.05$$.

#Create function to compute cut-off
cutoff.vartest <- function(n, alpha) { qchisq(1-alpha, df = n-1)/(n-1) }

#Compute cut-off value for sample variance
cutoff.vartest(n = 100, alpha = 0.05)

[1] 1.244699