$$\sigma^2$$ is a nuisance parameter.

## Two-side composite hypothesis test

$$X_1,\dotsc,X_n \sim N(\mu,\sigma^2)$$

$$H_0: \mu = \mu_0$$

$$H_1: \mu \neq \mu_0$$

$\Lambda \left( x \right) = \frac{ sup \{ L(\theta | x) : \theta \in \Theta_0 \}}{sup \{ L(\theta | x) : \theta \in \Theta \}}=\frac{ sup \{ L(\mu,\sigma^2 | x) : \mu=\mu_0,0<\sigma^2<\infty \}}{sup \{ L(\mu,\sigma^2 | x) : 0<\mu<\infty,0<\sigma^2<\infty \}} = \frac{L_0}{L}$ For the denominator, we have

$L= \left( \frac{1}{2\pi\widehat{\sigma}^2} \right)^{\frac{n}{2}} exp \left[ - \frac{\sum_{i=1}^{n} (x_i - \mu_0)^2 }{ 2 \widehat{\sigma}^2} \right]$ Given that $$\widehat{\mu}=\overline{x}$$ and $$\widehat{\sigma}^2 = \frac{1}{n}\sum_{i=1}^{n} (x_i-\overline{x})^2$$ (MLE estimates)

$L=\left( \frac{1}{2\pi \frac{1}{n}\sum_{i=1}^{n} (x_i-\overline{x})^2} \right)^{\frac{n}{2}} exp \left( -\frac{n}{2}\right)=\left( \frac{n \, e^{-1}}{2\pi \sum_{i=1}^{n} (x_i-\overline{x})^2} \right)^{\frac{n}{2}}$ Similarly, for the numerator, we have $L_0=\left( \frac{n \, e^{-1}}{2\pi \sum_{i=1}^{n} (x_i-\mu_0)^2} \right)^{\frac{n}{2}}$ Then $\Lambda \left( x \right) = \left[ \frac{\sum_{i=1}^{n} (x_i-\overline{x})^2}{\sum_{i=1}^{n} (x_i-\mu_0)^2}\right]^{\frac{n}{2}}$ Given that

$\sum_{i=1}^{n}(x_i-\mu_0)^2 = \sum_{i=1}^{n}(x_i-\overline{x})^2 + n(\overline{x}-\mu_0)^2$ The likelihood ratio is

$\Lambda \left( x \right) = \left( \frac{1}{1 + \frac{n(\overline{x}-\mu_0)^2}{\sum_i(x_i-\overline{x})^2} }\right)^{\frac{n}{2}}$

So

$\left( \frac{1}{1 + \frac{n(\overline{x}-\mu_0)^2}{\sum_i(x_i-\overline{x})^2} }\right)\leq c^{\frac{2}{n}}$ which is equivalent to

$\frac{n(\overline{x}-\mu_0)^2}{\frac{1}{n-1}\sum_i(x_i-\overline{x})^2} \geq (n-1)(c^{-2/n-1})=k^*$ Hence $\frac{(\overline{x}-\mu_0)^2}{S^2/n} \geq k^*$ where $$S^2$$ is the sample variance. That is

$\frac{|\overline{x}-\mu_0|}{S/\sqrt{n}} \geq k^{**}$ $$\frac{\overline{x}-\mu_0}{S/\sqrt{n}}$$ is known as a $$T$$ statistic.

If $$X_1,\dotsc,X_n \sim N(\mu,\sigma^2)$$ is normally distributed, then $$T$$ follows a $$t$$ distribution with $$(n-1)$$ degrees of freedom.

If we want to fix $$\alpha$$ then

$k^{**} = t_{\alpha/2,n-1}$