Below is a sample from a normal distribution with mean 0 and variance \(\theta\). Find a 90% upper limit (that is an interval of the form [0,T), for \(\theta\) by deriving the corresponding likelihood ratio test. Note that 20 is NOT a large sample size.
x
[1] -12.17 -11.56 -11.44 -9.11 -8.10 -6.93 -1.74 -1.71 -0.40 0.56
[11] 1.94 3.12 3.72 7.05 7.98 9.40 9.46 11.07 13.83 19.14
For a one-sided interval that is an upper limit we need to find the hypothesis test for
\(H_0: \theta\ge\theta_0\) vs. \(H_a: \theta<\theta_0\).
Now
\[ \begin{aligned} &f(x_1,..,x_n;\sigma) = \prod_{i=1}^n\frac{1}{\sqrt{2\pi\theta}}\exp\left\{-\frac{x_i^2}{2\theta} \right\}=\\ &(2\pi\theta)^{-n/2}\exp\left\{-\frac{\sum x_i^2}{2\theta} \right\} \\ &l(\theta) =-n/2\log(2\pi)-n/2\log(\theta)-\frac{\sum x_i^2}{2\theta} \\ &\frac{dl(\theta)}{d\theta} = -\frac{n}{2\theta}+\frac{\sum x_i^2}{2\theta^2}=0\\ &\hat{\theta}=\frac{\sum x_i^2}{n}=:s/n \end{aligned} \]
Under the null hypothesis the maximum is achieved at s/n if \(s/n>\theta_0\) and at \(\theta_0\) if \(s/n<\theta_0\), so
\[ \max\{L(\theta);\theta\ge \theta_0\}=\\ \left\{ \begin{array}{cc} L(s/n) & \text{if }s< n\theta_0\\ L(\theta_0) & \text{if }s>n\theta_0\\ \end{array}\right. \] and so
\[ LRT(\pmb{x})=\frac{L(\hat{\hat{\theta}})}{L(\hat{\theta})}=\\ \left\{ \begin{array}{cc} 1&\text{ if }s< n\theta_0\\ \frac{L(s/n)}{L(\theta_0)} & \text{if }s>n\theta_0\\ \end{array}\right.\\ \]
Clearly “\(\Lambda(x)\) is small” is equivalent to “s is small”.
Now under the null hypothesis we have
\[ \begin{aligned} &X_1,..,X_n \sim N(0, \sqrt{\theta_0}) \\ &X_1/\sqrt{\theta_0},..,X_n/\sqrt{\theta_0} \sim N(0, 1) \\ &X_1^2/\theta_0,..,X_n^2/\theta_0 \sim \chi^2(1) \\ &(\sum_{i=1}^nX_i^2)/\theta_0 \sim \chi^2(n) \\ &\alpha=P((\sum_{i=1}^nX_i^2)/\theta_0<c)=pchisq(c;n)\\ &c=qchisq(\alpha,n)\\ &1-\alpha=P(\sum_{i=1}^nX_i^2/\theta_0>qchisq(\alpha;n))=\\ &P(\theta<\sum_{i=1}^nX_i^2/qchisq(\alpha;n))\\ \end{aligned} \] and so a 90% upper limit for \(\theta\) is given by
round(sum(x^2)/qchisq(0.1,length(x)), 1)
## [1] 129.7