STATISTICS – MODULE 12122 CHAPTER 5 HYPOTHESIS TESTING A statistical hypothesis is an assumption which is made concerning either the parameters of the population distribution or the shape of the probability distribution of the population. The assumption is called the null hypothesis and is generally denoted by H 0 , while the alternative hypothesis is denoted by H1 or H A . 5.1 Example 5.1 A test of a mean ( a Z -test or Normal test) Based on theoretical considerations, an economist predicts that the average cost of maintaining a car in London is £1,800 per year. Past records indicate that the standard deviation of cost is £300. To test his theory the economist selects a random sample of 900 London car owners. This sample has a mean of £1,824 . (a) Does the sample information indicate that the mean cost is more than the economist believes?. (b) Does the sample information indicate that the economist’s theory is incorrect?. Use a 5% level of significance for both tests. (a) So the hypothesis which the economist wishes to test is specified by H0 : Economists' theory is correct, and the alternative hypothesis is given by H1 : Mean cost more than economist believes where is the average cost of maintaining a car in London. (b) The null hypothesis H0 would be the same but the alternative hypothesis H1 would be H1 : Economists' theory is incorrect. Example 5.2 A test of a mean (t-test) A random sample of 69 households in a certain very large area is selected as part of a study of the recreation habits of community residents. The respondents indicate a mean amount spent annually for recreation of £350 per family. The sample standard deviation is £65. Test the hypothesis that the mean amount spent annually in the area is £375 per family using a 1% level of significance. 2 (a) So the hypothesis which we test is specified by H0 : Mean amount spent annually per family is £375 and the alternative hypothesis is given by H1 : Mean amount spent annually per family is different from £375 Example 5.3 ( Testing the significance of a linear regression model) An operations analyst conducts a study to analyse the relationship between production and manufacturing expenses in the electronic industry. Manufacturing expenses change as the volume of production varies but a change in manufacturing expenses would not necessarily cause a change in volume of production. He is interested in fitting a linear regression model to the data which would enable prediction of manufacturing expenses for a given level of production. He wants to know if any linear regression between the two variables is significant. A sample of ten firms, randomly selected from within the industry, yields the data below. Production V (thousands of units) Manufacturing Expenses M Production V (thousands of units) (thousands of pounds) 40 42 48 55 65 79 88 100 150 140 160 170 150 162 185 165 Manufacturing Expenses M (thousands of pounds) 120 140 190 185 In order to test if any linear regression between V and M is significant he tests the assumption that the slope parameter is significantly different from zero. Linear regression model E M V v 1 2 v or M i 1 2 vi i where i N 0 , 2 and E i j 0 i j ( i ,j =1,2.....n) Hence the null and alternative hypotheses are as follows: H0 : H1 : No linear regression. Significant linear regression . Hypothesis testing in Econometrics These are the sort of questions that you might use hypothesis testing to answer : 3 (i) (ii) (iii) (iv) (v) Is the marginal propensity to consume between 0 and 1? Do the demand curves slope downwards? Are there constant returns to scale in production? Is the demand for money related negatively to the interest rate? Are wage increases reduced by higher unemployment? Example 5.4 For (iii) above, we are asking a question about the parameters of a production function. In order to test this hypothesis we will have to specify a form of production function. Suppose the Cobb-Douglas production function is given by Q or y 0 K 1 L 2 where 0 ,1 , 2 are all parameters, K is the number of units of capital and L is the number of units of labour. The hypothesis of constant returns to scale becomes the hypothesis To test this we would take logs of both sides of the above equation to give ln y ln 0 1 ln K 2 ln L Let so that we can obtain a linear equation. Y ln y , A ln 0 , l ln L and k ln K then the above equation becomes Y A 1 k 2 l so we can use the linear model EY l , k A 1 k 2 l or Yi A 1 k i 2 li vi where E vi k i , li 0 The null hypothesis becomes H0 : Constant returns to scale. We might test this against the alternative hypothesis or H1 : Decreasing returns to scale. H1 : Increasing returns to scale. i =1,2.....n 4 5.2 Two-tailed and One-tailed Tests The question of whether a two-tailed test or a one-tailed test is to be performed depends on the alternative hypothesis H0 : 15 H1 : 15 e.g. Two-tailed test H0 : 15 H1 : 15 H0 : 15 H1 : 15 One-tailed test One-tailed test Examples 1. A manufacturer is interested in whether there has been a reduction in cost with the introduction a new manufacturing process. (Use a one-tailed test) 2. A manufacturer is interested in whether there has been an increase in cost with the introduction a new manufacturing process. (Use a one-tailed test) 3. A manufacturer is interested in whether there has been a change in cost (may be an increase, may be a decrease). (Use a two-tailed test) 5.3 Elements of a Statistical Test 1. Null hypothesis H 0 . 2. Alternative hypothesis H1 or H A 3. Test statistic 4. Rejection region(s) (RR) If the test is two-tailed there are 2 rejection regions If the test is one-tailed there is 1 rejection region Example 5.1 revisited. A test of a mean ( a Z -test or Normal test) (a) So the hypothesis which the economist wishes to test is specified by H0 : Economists' theory is correct, and the alternative hypothesis is given by H1 : Mean cost more than economist believes (b) The null hypothesis H0 would be the same but the alternative hypothesis H1 would be H1 : Economists' theory is incorrect. 5 6 Example 5.2 revisted . A test of a mean (t-test) A random sample of 69 households in a certain very large area is selected as part of a study of the recreation habits of community residents. The respondents indicate a mean amount spent annually for recreation of £350 per family. The sample standard deviation is £65. Test the hypothesis that the mean amount spent annually in the area is £375 per family using a 1% level of significance. (a) So the hypothesis which we test is specified by H0 : Mean amount spent annually per family is £375 and the alternative hypothesis is given by H1 : Mean amount spent annually per family is different from £375 7 5.4 Sampling Errors Whenever a significant deviation from the expected value is found in hypothesis testing, the null hypothesis H 0 can justifiably be rejected. If no significant deviation is found one is not equally justified in asserting the truth of the null hypothesis, i.e. accepting it. All that can be said is that the data could have been obtained if H 0 was true. Example 5.5 Perrier water problem Suppose the mean benzine level per bottle of Perrier water is and 0 is a level above which the water becomes unsafe to drink. We test HEAU : 0 Mean benzine level alright i.e. water safe to drink against H1 : > 0 Mean benzine level higher than safety value i.e. water unsafe to drink Perhaps test out H 0 by looking at the benzine levels of a random sample of 1000 bottles of Perrier water . 8 True Situation Your decision Water safe Water unsafe Water safe Water unsafe Types of Error True Situation Conclusion or decision of Experimenter H 0 true H1 false H 0 true H1 false H 0 false H1 true Correct Incorrect decision decision Type II error H 0 false H1 true Incorrect Correct decision decision Type I error Type I error 9 If we reject H 0 in favour of H1 when H 0 is true we commit a Type I error. The size of the type I error = % = level of significance of the test: = P (Rejecting H 0 / H 0 is true) = P (Value of test statistic is in RR / H 0 is true). Note P( H 0 is true) Type II Error If we accept H 0 as being true when in fact H 0 is false ( i.e. H1 is true ) then we commit a type II error. The size of the type II error = % = P (Accepting H 0 / H 0 is false) = P (Accepting H 0 / H1 is true) = P (Value of test statistic is not in RR / H1 is true) A type II error can be avoided by not accepting H 0 when you cannot reject H 0 on the basis of your sample results. If you cannot reject H 0 report this and consider taking another sample bigger than the first. If the level of significance of the second test based on a larger sample remains the same as that used in the first test based on the smaller sample, then increasing the sample size will decrease the type II error and may allow a definite decision on rejecting H 0 . If you cannot reject H 0 , obtaining an interval estimate for the unknown parameter using the sample results can be very helpful as it gives the plausible range of values within which the unknown parameter lies. As you decrease the Type I error you increase the Type II error and vice-versa. The only way to reduce both errors is to increase the sample size n. e.g. H0 : H1 : 1 where 1 5.5 Testing the validity of H0 Suppose the rejection region is defined by X c where c is a constant depending on . 10 An assumption H0 could be completely verified if we could examine the whole population. We are usually unable to do this for a variety of reasons so we have to investigate the validity of H 0 on the basis of sample results. In testing, if we obtain a result which is very different from what was expected under H 0 then it can be due to either of two things: Either (a) A not very probable event has occurred and H 0 is true or (b) Null hypothesis H 0 is incorrect and should be rejected in favour of a more plausible hypothesis H1 . We conventionally conclude that (b) is the correct conclusion with the proviso that we could be wrong in our conclusion and the probability of this error is % which is the level of significance of the test. % represents the maximum risk of a wrong decision in rejecting H 0 in favour of the alternative hypothesis H1 . If we reject H 0 when H 0 is true and so should not be rejected, we call this a Type I error and P( A Type I error) = % , the level of significance of the test. In a court of law at the beginning of a court case, the defendent (i.e. the accused) is assumed innocent. Then the evidenceis considered and on the basis of this evidence, the defendent is either found guilty i.e. the original assumption of innocence is rejected or they are found not guilty . It is similar in hypothesis testing. The null hypothesis H 0 is assumed true and then the sample evidence is examined to see if it supports the null hypothesis H 0 or tends to discredit the null hypothesis H 0 . If it discredits H 0 , then H 0 is rejected in favour of a more plausible assumption i.e. H 0 is rejected in favour of H1 at a chosen level of significance. Procedure for testing a null hypothesis Assume H 0 , the null hypothesis, is true, decide on the appropriate test statistic to use and 1. calculate the probability of a particular event occurring if H 0 is assumed to be true. This is known as the p-value. If this p-value is very small, reject H 0 in favour of the alternative hypothesis H1 . 2. If the p-value 5% we can reject H0 at the 5% level of significance. If the p-value 1% we can reject H0 at the 1% level of significance. 3. Often it is not possible to calculate the p-value in which case you set up rejection regions depending on whether the test is two-tailed or one-tailed. If the test is two-tailed, there are two rejection regions whereas if the test is one-tailed there is only one rejection region. If the calculated value of the appropriate test statistic lies inside the rejection region(s), we reject H 0 . The size of the rejection region(s) depends on the chosen level of significance of the test. 4. If the p-value is not small or our calculated value of the test statistic does not fall within the 11 rejection region, we report that there is insufficient sample evidence to reject H 0 in favour of the alternative hypothesis H1 . Note that we are not justified in accepting H 0 just because on the basis of one sample we have been unable to reject it. In this case we can either repeat the test with a bigger sample or estimate the unknown parameter using a point or interval estimate.If we cannot reject a null hypothesis on the basis of the sample data and we decide to accept H 0 as being true, we might commit a Type 2 error which is where we accept H 0 as true when in fact it is not true. 5.6 Connection between confidence intervals and two-tailed tests Suppose we wish to test the following null hypothesis: H0 : * against the alternative hypothesis given by H1 : * , at the % level of significance. Suppose also we have already constructed a 100( 1- )% confidence interval for , for example a, b so that we are 100( 1- )% confident that has a value between a and b. If the value * lies outside the confidence interval, i.e * b or * a , then we can reject H0 in favour of H1 at the % level of significance. If the value * lies inside the confidence interval, i.e. a * b , then we cannot reject H0 at the % level of significance. Example 5.6 For Example 5.2, test the null hypothesis against the alternative hypothesis significance. H0 : 372 H1 : 372 at the 1% level of From Example 4. 6 Chapter 4, a 99% confidence interval for is given by 329.08 , 370.92. Our value of 372 is outside the confidence interval, so we can reject H0 in favour of H1 at the 1% level of significance. If you want to test one-tailed hypothesis tests you can still do so, but you can only use one-sided confidence intervals to do this. We have not covered one-sided confidence intervals on this course. Reading for Chapters 4 and 5 Gujarati D. Essentials of Econometrics Chapter 4 not including 2 and F tests. Crawshaw and Chambers A concise course in A-level Statistics , (3rd edition ), relevant parts of Chapters 9 and 10 (tests 1 and 2 only in Chapter 10). 12 C.Osborne March 2002