# Hypothesis testing with Neyman–Pearson (finding cutoff quantile of Poisson dist)

I am currently trying to solve a problem that should be very easy, yet I am stumped, and help would be GREATLY appreciated!!

The background of the question is this:

Q: The number of typing errors in a newspaper can be modeled by a Poisson distribution with some mean $μ$. Each of the $31$ students in a journalism course are allocated at random a past edition of the The Guard newspaper and asked to find the number of typing errors it contains. The total number of errors found by the students is $120$, i.e. $\sum_{i=1}^{n}y_i=120$.

It has been hypothesized by the instructor of the course that there are an average of $5$ typing errors in each edition of The Guard. The editor of the newspaper has objected, claiming that the mean is less than $5$ per edition. You want to test this with at $5\%$ significance level.

Here is where I begin my work

So I want to test: $H_0:\mu_o=5$ and $H_a:\mu_a<5$.

According to the Neyman Pearson lemma, we can create the most powerful test by looking at the likelihood ratio (LR). I simplified the LR and got the following which I believe is correct, hopefully!

$$LR= e^{-n\mu_a+n\mu_0}(\frac{\mu_a}{\mu_0})^{\sum_{i=1}^{n}y_i}$$

Now looking at the ratio, and the fact that $\mu_a<\mu_0$, we can see that effectively our test statistic is $\sum_{i=1}^{n}y_i$, and as it increases, we get less comfortable rejecting $H_0$, since it makes our LR smaller.

Now this is where I am stuck:

Now I know that to reject $H-0$, I need to find the cut off value where $\sum_{i=1}^{n}y_i \le k$ where $k$ is the cutoff value.

So since $\sum_{i=1}^{n}y_i$ is our test statistic, we can say that we have $n=31$ independent Poisson distributions which leads our test statistic to have $n\mu_0$ Poisson distribution. I am unsure if what I just did is correct or not, but assuming it is, we next want to find $k$. Using $R$, we have our test statistic model $n\mu_0$ $=$ $31\cdot4=124$ which we can use in $R$.

qpois(0.05 ( = significance level) ,124) ( = our new parameter for the mean under H_0) = 106

which is incorrect. Hopefully this clears up the confusion! Thanks so much everyone!!

• Remember the Poisson is discrete, so the quantile function can't return exactly $k:\Pr(\sum Y\leq k)= 0.05$. What it does return is in the manual. Mar 20, 2014 at 9:37
• You should also clarify how your model & hypotheses are describing the problem. Define $H_0$ & $y$ & $n$ properly. If $\sum y$'s the sum of errors over 31 newspapers, & $H_0$ concerns the mean no. errors per paper then how do the two relate? Mar 20, 2014 at 10:39
• Thank you for your help. If qpois is not to be used to find the quantile, then why is it there? My textbook hint says to use ppois but that would give us a probability, what we want is a cutoff point? Sorry, I'm just terribly confused :/ Mar 20, 2014 at 18:45
• Why are you using $0.05$ as the argument to qpois? Don't you want to use $1-0.05$?
– whuber
Mar 20, 2014 at 19:22
• I have tried $0.95$ as well as $0.05$ and the answer is either $1$ or $0$ respectively. I was using $0.05$ since we want the lower tail quantile. Mar 20, 2014 at 19:24

Apart from a few oddnesses with notation, you seem to have almost got it sorted out.

This bit is wrong, though:

Now to find the value of k where we would reject H0 when the total number of observed errors is no greater than k, can we not just use R with the following code:

qpois(0.05 = the alpha level,5 = value of null)


You need to stick with the observed number of errors across the sample. With 31 people, you won't observe only a few errors. If you try to work with 'number of errors per person' (i.e. you divide the total number of errors by the number of people), it's no longer a Poisson distribution, but a scaled Poisson (it takes values that are multiples of $\frac{1}{31}$), and the ignoring the distinction will give you grief. Better to just work with the integer variable, "the total count of errors".

Under the null hypothesis, the distribution of $\sum_i y_i$ has a distribution you can easily work out.

You can then use the inverse cdf, or quantile function (qpois in R) to compute the critical value you need for your rejection rule, but take care about what it gives you. If it's not clear to you why you would subtract 1 as whuber suggested, you should use the cdf (ppois in R) to compute the actual significance level for the rejection rule you propose; that should make it obvious why. (Alternatively, draw a diagram of what's going on, and it should soon become clear.)

Here I've drawn the probability function for the total count of a similar but different problem (one with different numbers): The aim is to find the value $C$ which will yield a type-I error rate that is no more than 0.05 (the sum of all the probabilities up to and including it, as suggested by the brace underneath the diagram). If you keep that straight, you should have little trouble working out what's going on

• Hey @Glen_b thanks so much, so I have updated the question quite thoroughly now so hopefully that sheds more light on things. So the distribution of the sum of $y_i$ is important correct? That is what I have tried to do but it still doesn't work. I believe my previous approach was completely wrong! Thanks so much for your guidance! Mar 21, 2014 at 0:50
• nicefella: If the null holds, what is the distribution of the total number of errors for 31 people? Mar 21, 2014 at 0:56
• It is a $n\mu_0$ Poisson distribution I believe (hopefully)! Mar 21, 2014 at 0:58
• Correct. But you actually know both $n$ and $\mu_0$, so you can state it as a number. It's a Poisson with a known mean. Perhaps if you plot that probability function. Mar 21, 2014 at 0:59
• No, you need to have (up to) 5% in the lower tail. If the alternative was ">5" you'd need (up to) 5% in the upper tail. If the alternative was "$\neq$5" you'd need (up to) 5% in total between the two tails. You have the first kind of problem. You need to compute a value for $C$ which has no more than 5% of the probability at or below it. (Sorry I keep using $C$ instead of the $k$ in your question -- simple lack of attention to your notation on my part.) Mar 21, 2014 at 1:53