# Hypothesis Testing show LRT is Chi-Square test

Let $$(X_1,...,X_n)$$ be a random sample with PDF $$f(x;\theta) = \frac{x}{\theta}\exp(-x^2/(2\theta)), \theta > 0$$

I want to show that the likelihood ratio test of $$H_0 : \theta \le \theta_0$$ against $$H_1 : \theta > \theta_0$$ where $$\theta_0>0$$ is given is a Chi-square test

This gives that the the likelihood function $$\displaystyle L(\theta) = \frac{\prod x_i}{\theta^n}\exp(-\sum x_i^2/2\theta)$$

I am going to set $$t = \prod X_i$$ and $$s = \sum X_i^2$$. So we get $$\displaystyle L(\theta) = \frac{t}{\theta^n}\exp(-s/2\theta)$$. And $$\max_{\theta \ge 0 }L(\theta)$$ occurs when $$\theta = \frac{s}{2n}$$

And $$\max_{0 \le \theta \le \theta_0} L(\theta) = \begin{cases} L(\frac{s}{2n})&\text{if }\theta_0 \ge \frac{s}{2n}\\ L(\theta_0)&\text{else} \end{cases}$$

Now we have

$$\Lambda_{H_0} = \frac{\max_{0 \le \theta \le \theta_0} L(\theta)}{\max_{0 \le \theta } L(\theta)} = \begin{cases} 1 &\text{if } \theta_0 \ge \frac{s}{2n}\\ \bigg (\frac{s}{2n\theta_0}\bigg)^n\exp(n - s/(2\theta_0))&\text{else} \end{cases}$$

Hopefully I have calculated both of those correct, now is where I run into my issue I don't quite see how this is a Chi-square test.

• $X_i^2/\theta \sim \chi^2_2$ independently for all $i$, so $\sum_{i=1}^n X_i^2/\theta \sim \chi^2_{2n}$. Your test should reject $H_0$ for small values of $\Lambda$. So what is your critical region? Aug 4 '20 at 18:58
• @StubbornAtom I am not actually very familiar with the Chi-square distribution. Can you explain why $X_i^2/ \theta \sim \chi_2^2$? Aug 4 '20 at 20:18
• I was trying to do that but the issue I run into is finding the CDF of $X_i$, as $\displaystyle \int_{-\infty }^y \frac{x}{\theta}\exp(-x^2/(2\theta))dx = -\exp(-y^2/(2\theta))$ which is negative and a CDF shouldn't be negative. EDIT: I noticed that it $X_i$ cannot take negative values so I should be integrating from $0$ not from $-\infty$ Aug 4 '20 at 20:53
• If I then calculate to get the distribution: The CDF of $X_i^2/\theta$ is $P(X_i^2/\theta \le y) = P(0\le X \le \sqrt{y\theta}) = F_{X_i}(\sqrt{y\theta})-F_{X_i}(0)$ since $X_i$ is only non-negative. Then the new PDF will be $g(x) = \frac{1}{2\theta}\exp(-x^2/2)$ which the only issue is I have $\theta$ otherwise it is the Chi-square with two degrees of freedom pdf. Aug 4 '20 at 21:57
• There's an exponent of 2 that shouldn't be there. It should be $\frac{1}{2\theta}\exp(-x/2)$. Aug 5 '20 at 0:11

The given density is a Rayleigh. If a sufficient estimator exists, the test must be based on this estimator.

It is very easy to verify, via factorization theorem, that this sufficient statistic is $$T=\sum_{i} X_i^2$$

Now let's derive the density of $$Y=X^2$$

Via fundamental transformation theorem you find

$$f_Y(y)=\frac{\sqrt{y}}{\theta}e^{-\frac{y}{2\theta}}\frac{1}{2\sqrt{y}}=\frac{1}{2\theta}e^{-\frac{y}{2\theta}}\sim Exp(\frac{1}{2\theta})=Gamma(1;\frac{1}{2\theta})$$

Now

$$\sum_i X_i^2 \sim Gamma (n;\frac{1}{2\theta})$$

And concluding...

$$\frac{1}{\theta}\sum_i X_i^2\sim \chi_{(2n)}^2$$

To find the critical region, first observe that $$\theta_0 < \theta_1$$ and

$$\frac{L(\theta_0|\mathbf{x})}{ L(\theta_1|\mathbf{x}) }\propto e^{(\frac{1}{2\theta_1}-\frac{1}{2\theta_0 })\sum_iX_i^2}$$

It is evident that LR is a decreasing function of $$T=\sum_iX_i^2$$.

Now you can apply Theorem 9.6 taken from Mood Graybill Boes and define the critical region

$$C=\{\mathbf{x}:\sum_iX_i^2>k\}$$

getting a size $$\alpha$$ UMP Test for $$\mathcal{H}_0:\theta \leq \theta_0$$ against $$\mathcal{H}_1:\theta > \theta_0$$ using a chi-square distribution as showed above.

\begin{align} L(\theta) & = \frac{t}{\theta^n}\exp\left(\frac{-s}{2\theta} \right) \\[8pt] \ell(\theta) = \log L(\theta) & = -n\log\theta - \frac s {2\theta} + (\text{something not depending on } \theta) \\[8pt] \ell\,'(\theta) & = \frac{-n}\theta + \frac s {\theta^2} = \frac{s-n\theta}{\theta^2}\quad \begin{cases} >0 & \text{if } \theta s/n. \end{cases} \\[8pt] \end{align} So $$\widehat{\theta\,} = s/n.$$

So the likelihood ratio is $$\begin{cases} 1 &\text{if } \theta_0 \ge \frac s n, \\[8pt] \bigg (\dfrac{s}{n\theta_0}\bigg)^n\exp\left(\dfrac n2 - \dfrac s {2\theta_0}\right)&\text{else}. \end{cases}$$ You reject $$\text{H}_0$$ if this piecewise expression is improbably small.

Now here is the crucial fact: The expression above is a decreasing function of $$s^2.$$ Therefore you reject $$\text{H}_0$$ if $$s^2$$ is improbably big.