# 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. Commented Aug 5, 2014 at 21:25

1. Your hypothesis test uses the scale parameterisation of the Exponential distribution ("Where $$\lambda$$ is the population mean time between accidents$), whereas your answer uses the rate parameterisation. The correct likelihood is $$L(\lambda;\underline{x}) = \prod_{i=1}^n f_{X_i}(x_i;\lambda) = \prod_{i=1}^n \frac{1}{\lambda}e^{-x_i/\lambda} = \lambda^{-n} e^{-n\bar{x}/\lambda}$$ 1. The likelihood-ratio test is suitable when we're testing hypotheses of the form $$H_0: \, \theta \in \Theta_0$$ versus $$H_1: \, \theta \in \Theta_0^c$$, the complement of $$\Theta_0$$. In your example, if we want $$H_1: \, \lambda < 4$$, then we have to take $$H_0: \, \lambda \geq 4$$. I posted a more detailed answer here: Likelihood ratio test for composite alternative hypothesis 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. Commented Aug 5, 2014 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 Commented Aug 5, 2014 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? Commented Aug 5, 2014 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 Commented Aug 5, 2014 at 21:12 • I think this answer is confusing because the question refers to the scale parameterisation of the Exponential ("Where$\lambda\$ is the population mean time between accidents"). I posted a clarification here: stats.stackexchange.com/questions/604623/… Commented Feb 8, 2023 at 9:24