# Likelihood ratio test to determine if average number of accidents has dropped?

I can't find any worked (non-trivial) practical example for a likelihood ratio test, believe me I have spent hours looking. Here is a question I've been trying to complete but I can't get any further. Can anyone show me how to complete this, and also tell if I am on the right track with the work I have done?

Question

The average time between accidents on a road is 4 days. This year a random sample of accidents showed that the time between accidents was 2, 3, 6, 1 days. Is there evidence that the number of accidents has dropped on average? Use a likelihood ratio test.

Attempt

Our hypotheses are

$H_0: \lambda = 4$

$H_1: \lambda < 4$

Where $\lambda$ is the population mean time between accidents

Our likelihood ratio test is

$$\phi = \frac{\sup_{\lambda \in \Omega_{H_{0}}}L(\lambda | \underline x)}{\sup_{\lambda \in \Omega}L(\theta|\underline x)}$$

Now, $L(\lambda|\underline x) = \prod_{i=1}^4 f(x_i|\lambda)$

$= \lambda^n e^{-\lambda \sum_{i=1}^n x_i}$

$= \lambda^n e^{-\lambda n \overline{x}}$

So we have - $$\phi = \frac{\sup_{\lambda\in \Omega_{H_{0}}}\lambda^n e^{-\lambda n \overline{x}}}{\sup_{\lambda\in \Omega}\lambda^n e^{-\lambda n \overline{x}}}$$

We only have one choice for $\lambda$ in $H_0$ (although I'm not sure if I should be using $4$ or $\frac{1}{4}$ for $\lambda$) and $n=4$ giving us

$$= \frac{4^4 e^{-4 * 4 * \overline{x}}}{\sup_{\lambda\in \Omega}\lambda^4 e^{-\lambda 4 \overline{x}}}$$

$$= \frac{256 e^{-16 \overline{x}}}{\sup_{\lambda\in \Omega}\lambda^4 e^{-\lambda 4 \overline{x}}}$$

I'm not sure what to do now. How do I deal with the sup in the denominator? Can I sub in $3$ for the $\overline x$'s due to the random observations of $2, 3, 6$ and $1$? Has my work up to this point been correct?

• The MLE would presumably be the $\lambda$ that will maximize the likelihood, since that's what it's actually for. – Glen_b Aug 5 '14 at 21:25

In terms of finding sup, think of it as finding maximum of that equation, $\lambda^{4}e^{-\lambda 4\bar{x}}$. Well recall that the MLE for an estimator is the value that maximizes the likelihood function, and the MLE for $\lambda=\bar{x}$ so we have $\sup_{\lambda \in\Omega}\lambda^{4}e^{-\lambda 4\bar{x}}=\bar{x}^{4}e^{-\bar{x}(4\bar{x})}$ Through manipulations you should get that test where we reject $H_{o}$ iff $\bar{x}\leq c$ for some $c$ that corresponds to the significance level you want (after looking at this it may be easier to have $\sum_{i=1}^{4}x_{i}\leq c$ since you can find distribution of $\sum_{i=1}^{4}X_{i}$ where $X_{i}\sim Exp(4)$)

In order to help you out I will go through the whole derivation because even when I did these types of questions at first they get quite messy. So we know the likelihood ration test has form $$\Lambda(x)< c$$ where c corresponds to the significance level you want and $\Lambda(x)$ is the likelihood ratio statistic given by $$\Lambda(x)=\frac{\sup_{\lambda\in\Theta_{H_{o}}}L(\lambda|x)}{\sup_{\lambda\in\Theta}L(\lambda|x)}=\frac{L(4|x)}{L(\bar{x}|x)}$$ where we get denominator since maximum likelihood estimator for $\lambda$ (i.e. the number that maximizes the likelihood function thus at that point will be supremum). Now the likelihood function we have is $$L(\lambda|x)=\lambda^{n}e^{-\lambda\sum x_{i}}=\lambda^{n}e^{-\lambda(n\bar{x})}$$ thus we have $$\Lambda(x)=\frac{4^{n}e^{-4(n\bar{x})}}{\bar{x}^{n}e^{-\bar{x}(n\bar{x})}}$$ thus for likelhood ratio test we have these equivalent inequalities $$\frac{4^{n}e^{-4(n\bar{x})}}{\bar{x}^{n}e^{-\bar{x}(n\bar{x})}}< c_{1}$$ $$\frac{e^{-4(n\bar{x})}}{e^{-\bar{x}(n\bar{x})}}< c_{2}\rightarrow e^{n\bar{x}(-4+\bar{x})}< c_{2}$$ by taking $\ln$ of both sides we have (since increasing function maintains order i.e. direction of sign remains the same) $$n\bar{x}(-4+\bar{x})< c_{3}$$ $$n\bar{x}< c_{4}\rightarrow \sum x<c_{4}$$ (NOTE: the different $c_{i}$'s I have is just me doing algebra operations to both sides like dividing and subtracting constants)

Thus finally the maximum likelihood ratio test is equivalent to $$\textrm{Reject Null iff }\sum x< c$$ for $c$ that corresponds to significance level for distribution of $\sum x$ (hint: what is distribution of sum of iid $Exp(4)$ rvs?)

Also when you want questions like these answered it may be better to ask math stack exchange because user there can answer more derivation like these. cross validated is excellent for questions on methods and applications of statistics

• What about the numerator in the last line of my workings? I am having alot of trouble with this over the last few days so I was hoping someone could show me how to work out from where my last line to the final result. The manipulations might seem trivial but I always get caught on these kinds of things without examples to go on. This one has cost me days at this stage..sigh. – sonicboom Aug 5 '14 at 19:20
• Yea I hoped it helped, those problems can get very messy but once you do them a few times you get the hang of it – Kamster Aug 5 '14 at 20:55
• Just one thing, do we have to take account of the parameter space being $< 4$ when determining the maximum likelihood for the denominator? I'm not sure where the alternative hypothesis $H_1$ cones into play? – sonicboom Aug 5 '14 at 20:59
• I noticed that my answer actually may be wrong since I originally thought it was pois distribution for some reason and changed it but didn't change fact that maximum likelihood estimator for exp is $\frac{1}{\bar{x}}$ so instead look at stats.ox.ac.uk/~dlunn/b8_02/b8pdf_8.pdf (first example for help) Sorry about that – Kamster Aug 5 '14 at 21:12

The likelihood ratio test implies that we are considering two hypotheses with one nested inside the other (in order that the test statistic follows an approximate chi-squared distribution).

The null hypotheses Ho is (presumably) exponential with mean 4. The alternate hypothesis has mean of 3. The 3 is the maximum likelihood estimate of the exponential parameter from the data which in this case is just the mean.

Plugging these values into the likelihood function and calculating 2 * difference in negative log-likelihood gives the test statistic. This can be compared against chi-squared distribution with 1 degree of freedom (due to one parameter estimated from the data).