 This is a video about hypothesis testing and in particular hypothesis tests where the test statistic has a Poisson distribution. I'm going to look at three examples. The first will be a typical case where the test statistic has a Poisson distribution. The second will be a case where the test statistic actually has a binomial distribution but we'll want to approximate that with a different random variable that has the Poisson distribution. In other words, we'll want to use a Poisson approximation to the binomial. And the third example will be a case where the test statistic has the Poisson distribution but we'll want to use the normal approximation in order to calculate the relevant probability. So let's look at the first example. And this is going to be to do with large fires in the US. In particular, we're going to be looking at large fires that burn over 100,000 hectares of land. That's over 100,000 square kilometres of land. So large fires in the US have occurred at the rate of about 9 per year over the last decade or so. But in 2012, there were 16 large fires. So let's test at the 5% level of significance whether the rate of large fires has increased. Now, the number of large fires is a number of events in a fixed interval of time. So it makes sense to assume that the test statistic here has the Poisson distribution. The number of fires should have the Poisson distribution with parameter lambda. And we should set our null hypothesis as lambda equals 9 because that should be our default assumption about the number of large fires that should happen in one year. Lambda would be 9 if there's been no change from the historical average. Our alternative hypothesis would be that lambda is greater than 9 because we want to know whether the rate of large fires has increased. Okay, now the probability that we want to work out is the chance that we get 16 large fires or a number like 16 large fires. But remember, what we mean by like 16 is 16 or more because the alternative hypothesis says that lambda is greater than 9. So the numbers that are like 16 here are the numbers that are greater than 16. So we need to find the probability of getting 16 or more large fires on the assumption that lambda equals 9. Now we'll do that using the tables. And in order to use the tables, we need to convert this into the probability that x is less than or equal to something. So the probability that x is greater than or equal to 16 will be one take away the probability that x is less than or equal to 15. And that's something we can look up using the tables. If we find where lambda equals 9 and we look along the row where x is equal to 15, we see the probability 0.9780. So the probability that we want to calculate is one take away 0.9780 and that's equal to 0.0220. Now that's a lot less than 5% the level of significance that we're using. So this means that we will reject H0. The logic here is that if lambda equal to 9, then the probability of getting 16 or more large fires would be tiny. So small that what we're going to say is that we don't believe that lambda is equal to 9. The probability of that outcome is so tiny that we don't believe the null hypothesis anymore. So we reject the null hypothesis. And that means that we've got sufficient evidence to conclude that the rate of large fires has increased. Okay, so that's one way of answering this question. But you should be aware that there's a different method and that uses a critical region. If we go back to this stage, we can find the critical region, in other words the set of values which would cause us to reject the null hypothesis. And we can do that using the tables. What we need to do in this case is to scan up the column where lambda equals 9 and stop at the last probability that's still greater than 0.95. So in this case we stop at 0.9585. So that means that the probability of getting 14 or less is 0.9585. And if we subtract that from 1, 1 minus 0.9585 will be the probability of getting 15 or more. So if we come along the row that's just below 0.9585, we reach 15. And the critical region here will be the numbers that are 15 or more. It's really important to understand why we come along the row below. That's because 0.9585 is the probability of getting 14 or less. But when we subtract that from 1, 1 minus 0.9585 is the probability of getting 15 or more. So we can say here that the critical region is x is greater than or equal to 15. It's the numbers that are 15, 16 and higher. And obviously 16 is in the critical region here. And that's another way of seeing that we should reject H0. And we can say that there's enough evidence to conclude that the rate of large fires has increased. Okay, so that's two ways of answering this question, two ways of carrying out this hypothesis test. It's completely up to you which one you want to use. Okay, now before we finish this example, it's worth pointing out that an increased rate of fires is one predicted outcome of climate change. And so it would be interesting to know what's been happening to the rate of large fires in America. So here's a graph which shows the number of large fires each year for the last decade or so. You can see that it's very variable and that's not surprising because the number of very large fires is quite small. And so it's subject to random events. But nevertheless, there is an upward trend. And if I draw a line of best fit, you can see that it's steadily going upwards. So there's some evidence here that the rate of large fires in America is increasing. And that should be a great cause of worry because, needless to say, large fires cause a lot of destruction. And one more thing before we move on. I said at the beginning that the test statistic will have the Poisson distribution because it represents the number of events in a fixed interval of time. But let's just think about whether it meets all the criteria for a Poisson distribution. So the first criterion is that the events must occur randomly in a fixed interval of time or space. And that seems to be okay. Presumably fires do on the whole occur randomly. They're caused by things like lightning strikes. And although some of them are triggered by human beings, they're presumably mostly by accident. And even the odd one that's set off deliberately, I suppose you could still see as a random event. But the second criterion says that they must occur at a constant average rate. And a little thought will show that that's probably not true of large fires. Because presumably on the whole they're more likely to occur in the summer when the ground is dry and warm. And they're much less likely to occur in the winter or when it's raining. So it's very unlikely that fires occur at a constant average rate. The third criterion says that they must occur independently. And that probably won't be true either. Because if you know that a fire has just happened, that indicates that you're probably dealing with the summer months where it's warm and dry. And that there are lightning storms around. And that means that if one fire has just been triggered, it's probably more likely that another one is going to happen fairly soon. So it won't be true that the fires occur independently, I don't think. The final criterion says that things must occur one at a time. I'm not sure about this one. It's probably case because if you had two fires being triggered near to each other, perhaps related, they'd probably just merge into one anyway. And they'd probably count as one big fire. But it's clear that not all of these criteria are satisfied. And so it's doubtful whether the number of fires would have an exact Poisson distribution. But hopefully the distribution of the test statistic will be sufficiently similar to a Poisson distribution for the hypothesis test to be valid. And remember the probability that we calculated was significantly less than 5%. Okay, let's move on and look at my second example. And this is going to be to do with connecting to a Wi-Fi network. Suppose that a teacher manages to connect to his school's Wi-Fi network once every 20 attempts on average. And he complains about this a lot. So the school carries out some network maintenance to try and improve the situation. But afterwards, the teacher manages to connect only twice in his first 150 attempts. Can we conclude that the network maintenance has made a difference to the teacher's ability to connect to the Wi-Fi network? With a random variable here, the test statistic will have a binomial distribution because we're dealing with a number of successes in a sequence of trials. The trials of the attempts to connect to the network and success is managing to get online. The null hypothesis will say that P is 0.05, the probability of success is 1 over 20 because we're told that in the past the teacher manages to connect once every 20 attempts. The alternative hypothesis will be that P is not equal to 0.05. It won't say that P is less than 0.05 or P is greater than 0.05 because we're asked to look into whether the network maintenance has made a difference to the teacher's ability to connect. We're not asked to find out whether it's improved it or reduced it. We're just asked to find out whether it's made a difference. Okay, so in principle we're dealing with a test statistic that has a binomial distribution. But you may remember that the tables we have for the binomial distribution don't tell us about the situation where n, the number of trials, is 150. The number of trials here is too big for us to be able to calculate probabilities easily. So the thing to do is to use a Poisson approximation. And that's valid because we're dealing with a situation where the number of trials is large and the probability of success is small. And if the number of trials is large and the probability of success is small then we're allowed to use the Poisson distribution to approximate the binomial distribution. Now in order to do that we need to find the expected number of successes and that's going to be n times P. Lambda will be 150 times 0.05. And that's 7.5. So the expected number of successes is 7.5. And so instead of using our original test statistic we'll use a new test statistic which has the Poisson distribution with parameter 7.5. Now the probability that we need to calculate is the probability that x is less than or equal to 2. We need to find the probability that the number of times the teacher manages to connect is a number like 2. And like 2 here means less than 2. Because clearly no successes and one success are further away from 7.5 than 2. So we'll calculate the probability that x is less than or equal to 2. We can do that easily by looking at the tables. We find the column where lambda equals 7.5 and we look along the row where x is equal to 2 we get the probability 0.0203. So the chance that x is less than or equal to 2 is 0.0203. The only thing is though that this is a two-tailed test because remember the alternative hypothesis says that P is not equal to 0.05. And so that's the probability that we could get an outcome like 2 which is less than 7.5, less than the expected number of successful connections. But we could also end up rejecting the null hypothesis by getting a number which is much bigger than 7.5. And so there are outcomes which are like 2 which are more than 7.5. So as we've only got the probability for some of the outcomes which are like 2 we need to double it. And double 0.0203 is 0.0406. So let's assume a significance level of 5%. 0.0406 is less than 5%. So this is another situation where we'll reject the null hypothesis. We'll say the probability of getting an outcome like 2 is tiny and that means we no longer believe that the probability of a successful connection is 1 in 20. In context we can say there's enough evidence to conclude that the maintenance has made a difference. Actually we have enough evidence to conclude that the maintenance has made the situation worse but that's not what we were asked to investigate. Now there's a couple of things I want to draw your attention to here. First of all this was a two-tailed test because the alternative hypothesis said that P was not equal to 0.05. And that's because in the question we were asked to look into whether the maintenance had made a difference not whether it had improved the situation or made it worse. And as it was a two-tailed test we needed to double the probability that we calculated. And that was because 0.0203 is the probability of getting an outcome like 2 which is less than 7.5 the expected number of events. But we also need to include the probability of getting an outcome like 2 that's much bigger than 7.5 an outcome which is much larger than the expected number of successful connections. And the point is that whenever you have a two-tailed test you're going to need to double the probability here. Okay so that's nearly the end of this example but before we move on I just want to investigate whether it's actually appropriate to say that the test statistic will have a binomial distribution. So let's look at the criteria for a binomial distribution. First of all the number of trials must be fixed and that's okay because we had 150 trials. And that's definitely a fixed number. The second criterion says that each trial must have the same two possible outcomes. And that's okay because clearly either the teacher manages to connect or he doesn't. The third criterion says that the trials must be independent. And I'm not sure whether this will be the case or not. I suppose it depends on precisely why the teacher isn't managing to connect to the network. It's possible that if the teacher hasn't managed to connect that's because of some temporary problem or glitch which means that it's less likely that he'll manage to connect immediately afterwards. And so it's possible that the trials are not independent. Although I need to know a lot more about how Wi-Fi networks actually work and why the teacher might not be able to connect in order to make a judgment here. The final criterion says that the probability of success must be the same in each trial. And that seems okay. I can't see any reason why the probability would differ from time to time unless the ability of the teacher to connect to the network depends upon how many other users are currently connected and then if the number of users changes from one time of day to another I suppose the probability of success might vary. So again it's not totally clear that a binomial distribution is appropriate in this case but hopefully the test statistic will have a distribution sufficiently close to the binomial distribution for the hypothesis test that we just did to be valid. Okay let's move on to my last example and this is going to be to do with teenage pregnancy in England and Wales. Here's a map which originally appeared in The Guardian which shows the different rates of teenage pregnancy of teenage conception more accurately in different parts of the UK. Everything here has been scaled relative to the population of each local authority area and the colouring is showing you where there are particularly high rates of teenage pregnancy where there are particularly low rates. So for example you can see that in Southwark in London and also in Method Tidville in Wales there's a particularly high rate of teenage pregnancy whereas in someone like Windsor and Maidenhead the rate is much lower. Now we're going to look at a particular example that involves Blackpool which as you can see is one of the nation's black spots where the rate of teenage pregnancy is particularly high. So in Blackpool the mean under 18 conception rate for the years 1998 to 2010 was 173 per year but in 2011 there were 149 under 18 conceptions in Blackpool. So we're going to test at the 5% level of significance whether the under 18 conception rate in Blackpool has decreased. Now again we're dealing with a random variable that's the number of events in a fixed interval of time so it's reasonable to think that this has the Poisson distribution. So let's assume that our test statistic has the Poisson distribution with parameter lambda. Now the null hypothesis will say that lambda is 173 because historically that's the mean under 18 conception rate. That should be our default. The alternative hypothesis will be that lambda is less than 173 because they're investigating whether the conception rate has gone down. Now we're about to find a probability for the Poisson distribution with parameter 173 but we're not going to be able to do that using the Poisson probability tables because they only cover the cases where lambda is less than or equal to 10. So what we need to do is to use a normal approximation and to do that we need to find the mean and the variance for this Poisson distribution. Well the mean is always the same as lambda so the mean will be 173 and the variance you may remember is also lambda so the variance will also be 173. So what we're going to do is look at a different random variable y which has the normal distribution with mean 173 and variance 173. Okay now the probability that we need to work out is the chance that x is less than or equal to 149 because we need to know the chance of getting a number like 149 under 18 conceptions and in this context like 149 means 149 or less. So we need to find the probability that x is less than or equal to 149 and that would be approximately the same as the chance that y is less than or equal to 149 and a half. Remember you need to make a continuity correction when you're using a continuous random variable to approximate a discrete one. So the probability that x is less than or equal to 149 is about the same as the chance that y is less than or equal to 149.5. Now to find that probability we standardize to the standard normal distribution. So that's the same as the probability that z is less than or equal to 149.5 take of 173 over the square root of 173. In other words it's the probability that z is less than or equal to minus 1.79. Well that's something that we can look up in the tables because if you find positive 1.79 you'll see that the probability that z is less than or equal to that is 0.9633. The only thing is that we don't want to know the probability that z is less than or equal to positive 1.79 we want to know the chance that it's less than or equal to minus 1.79. So what we have to do is to subtract the number that we looked up from 1 and do the sum 1 take away 0.9633 and that gives us the answer 0.0367. Okay well 0.0367 is less than 5% and that means that we can reject the null hypothesis. And in context we can say that there's enough evidence to conclude that the under 18 conception rate in Blackpool has gone down. Okay there's one thing I want to draw your attention to here and that's that we used a continuity correction when we were using the normal distribution to approximate the Poisson distribution. Remember you always have to make a continuity correction when you use a continuous random variable to approximate a discrete one. And that's because if x is discrete but y is continuous the probability that x is equal to 149 will not be the same as the probability that y is equal to 149. In fact the probability that y a continuous random variable is exactly equal to 149 will be 0. The chance that x is equal to 149 will be about the same as the chance that y is between 148.5 and 149.5. So when you're using the normal distribution to approximate the Poisson distribution you make a continuity correction on your way to calculating a probability. Okay you may be interested to see how the under 18 conception rate has been changing. And interestingly the under 18 conception rate in England and Wales has decreased enormously. It's gone down from 47.1 in 1998 to 30.9 in 2011. In Blackpool it's been much higher and there's been a lot more variation it's gone up and down but also it's been decreasing on the whole. By the way it's not surprising that the rate in Blackpool has gone up and down a lot more and that's because we're dealing with a much smaller number of under 18 conceptions and therefore there's going to be a lot more random variation in it. But they've both gone down and if we draw a line of best fit you can see that they both slope down quite reasonably. Well I suppose you should be careful of drawing a line of best fit here because there's no reason to suppose that the trend is linear. Okay well before I finish this video the whole topic of under 18 conceptions or teenage pregnancy as it's always referred to in the media is an interesting one and it's one where statisticians need to be careful. Here's what the Office for National Statistics in the UK has to say about teenage conceptions. They say it's widely understood that teenage conception and early motherhood can be associated with poor educational achievement, poor physical and mental health for both mother and child, social isolation and poverty and they say there's recognition that socio-economic disadvantage can be both a cause and a consequence of teenage motherhood. This is why the Labour government from 1997 to 2010 set a target to halve the under 18 conception rate in England by 2010 when compared with 1998. Local authorities like Blackpool have got 10-year strategies in place aiming to reduce the local rate between 40% and 60%. Well the interesting thing here is all this talk about association between under 18 conception and bad things like poor educational achievement, mental health, social isolation and poverty and the carefully worded statement that socio-economic disadvantage is both a cause and a consequence of teenage motherhood. So I just wanted to draw your attention to this because it shows how careful this group of statisticians is being not to overstate the importance of their findings. I mean here's a scatter chart which shows the degree of correlation between under 18 conception, teenage pregnancy and child poverty. Each dot represents one of the local authorities in England and for each local authority we've got the under 18 conception rate and also the percentage of children within that local authority that are living with poverty. And what you can see there's a very high degree of correlation between these two measures. So the local authorities with very high under 18 conception rates are also the places where high proportion of children are living in poverty and the opposite is true as well that the local authorities with a low under 18 conception rate are also the places where not many children are living in poverty. And if you remember back to the map of England and Wales that I showed you at the start that makes sense, remember we had Windsor and Maidenhead which had a very low under 18 conception rate and that's also somewhere that you think of with wealthy people and not much poverty whereas some of those black spots with high rates of teenage pregnancy are also places with high levels of poverty. So there's a very high degree of correlation between teenage pregnancy and bad things like poverty and bad educational achievement and so on. But what the statisticians are being careful about is not to say that one is actually the cause of the other because it could be that teenage pregnancy is a cause of poverty and bad mental health and things like that but it could also be the other way around it could be that bad mental health and bad educational achievement are causes of teenage pregnancy or of course it could be that neither is a cause of the other and actually there's something quite different that causes both. So it could be something of the lifestyle or the background of different places which means that first of all people opt to have children when they're still teenagers and on the other hand that they end up with bad educational results and end up being socially isolated and poor. So the statisticians who are being very careful not to overstate their case they say that there's an association but they don't tell us what's causing what and they say explicitly that the cause could work one way around or the other. Socio-economic disadvantage can be both a cause and a consequence of teenage motherhood. An interesting thing for statisticians is that all of these statistics and the correlation measures and the graphs don't really tell us precisely what we want to know which is I suppose whether the young mothers the women who have opted to have children when they're still teenagers are better off or worse off as a result and also whether the children are better off or worse off than if the mothers had chosen to wait until they were somewhat older. And that's something that we can't investigate so easily and we can't measure using the statistics that it's easiest to gather because you can see that the statistics that the Office for National Statistics are working with are ones that it's probably quite easy to get hold of I mean it must be relatively easy to find out the age of mothers at birth or conception by looking at hospital records and stuff like that. But it would be much harder to investigate vaguer questions like is this person better off or worse off because of having this child in particular because that would involve a value judgment and statisticians presumably are not so well qualified to make value judgments like that. And it's also fair to point out that the Office for National Statistics continue and should be noted that teenage conceptions can be the result of planning within established relationships and as such are not always a cause for concern. Okay so I hope you found that a little bit interesting. It's interesting to think about how we can use these statistics in a real world context and also how we need to be very careful in not drawing conclusions from statistics that are too strong. Okay thank you very much for watching my video about hypothesis testing. I hope you found it useful for showing you how to carry a hypothesis test where the test statistic has a plus on distribution. Thank you very much for watching. I hope you come back and watch one of my other videos soon.