LBSRE1021 Data Interpretation Lecture 9 Hypothesis Testing Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Last week- Confidence Interval With a sample size n>30 we can estimate the range within which the population mean lies (the confidence interval for the mean) by: pop mean = x +/- 1.96 se (95% CI) pop mean = x +/- 2.58 se (99% CI) se = sd for sample/ /n Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Testing a mean What happens if we know the value of some population mean and a sample taken from this population doesn’t appear to agree with it? Either the population parameter is not what we think, or the difference between the sample and population is simply due to chance effects Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
The null hypothesis We make the hypothesis that any departure from the supposed true population parameter by the sample estimate is due to chance effects We then see if we can disprove this hypothesis at a particular significance level The null hypothesis is written as H0 Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
The alternative hypothesis If we reject the null hypothesis we automatically accept the alternative hypothesis, H1 This hypothesis can be two-tailed or one-tailed Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Types of tests The form of the test depends on: the size of the sample the number of samples whether it is the mean or proportion that is of interest For tests on the mean we use the Z-statistic for large samples and the t-statistic for small samples Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Large (single) sample test for a mean When the sample size is large we use the normal approximation The test can be one-sided or two-sided Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
A two-tailed test (not equal to) using a 5% significance level Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
One-tailed test (less than) using a 5% significance level Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
One-tailed test (greater than) using a 5% significance level Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Steps for carrying out a hypothesis test Set up the null and alternative hypotheses Decide on the significance level (normally 5%) and determine the critical values Calculate the test statistic (this is the number of standard deviations that the sample estimate is away from the population parameter) Decide whether to accept or reject the null hypothesis Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Example 1 A food manufacturer processes and cans baked beans. The net weight of a standard can of beans is supposed to be 420g but a random sample of 50 cans gave an average weight of 415g with a standard deviation of 30g. Is there any evidence that the true mean weight is not 420g? (Use a 5% significance level) Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Solution to Example 1 Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Conclusion of the test result As the test statistic is between –1.96 and 1.96 we cannot reject H0. That is, there is no evidence at the 5% level of significance that the mean is not 420g. Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Example 2 (1 of 3) Bags of sugar weighing 1000g Weight packed by machine drifts Need to detect drift and reset machine but not stop process unnecessarily Null hypothesis u = 1000 ie: H0 : u = 1000 Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Example 2 (2 of 3) Standard deviation = 50g For 100 bags in a sample: s.e. = s.d. = 50 = 5g n 10 Sample mean x to test H0 Z = x - u = x - 1000 s.e. 5 Test is two-sided so compare value of Z with 1.96 and 2.576 Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Example 2 (3 of 3) e.g. if sample mean 1015g Z = 1015-1000 = 3 5 This is > 2.576 (1% level of significance) H0 rejected, H1 : u = 1000 accepted Mean weight now over 1kg with < 1% chance of being wrong to conclude this Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Example 3 (1 of 3) Noise in street Measured over long time between 4:30pm and 5:30pm Average noise 130 decibels s.d. 20 decibels Residents take 50 readings Mean 134 decibels Is noise increasing? Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Example 3 (2 of 3) H0 : u = 130 H1 : u > 130 (Is test one or two-sided?) Z = | x - u | = 134 - 130 s.e. 20/ 50 = 1.41 Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Example 3 (3 of 3) Critical values of Z 1.645 (5%) and 2.326 (1%) Difference between population mean and sample mean not significant as Z = 1.41 < 1.645 Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
t-test for a sample mean When the sample size is small we can use the t-test. The procedure is the same except that the critical value is found from t-tables using n–1 degrees of freedom. Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Hypothesis tests involving two means We can have: two large independent samples two small independent samples paired samples Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Two large independent samples The standard error of the difference between the means is: The test statistic is: Z = Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Two large independent samples continued The null and alternative hypotheses are: H1: 1 - 2 0 for a two sided test and H1: 1 > 2 or 1 < 2 for a one sided test Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
t-test for two independent small samples The standard error for two small samples is: = where is the estimate of the pooled standard deviation of the populations and is given by: Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
t-test for two independent small samples continued The test statistic is given by: Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd
Paired samples The null hypothesis is that the difference of the population means is zero and the alternative hypothesis can be either one-tailed or two-tailed. The test statistic for this test is: Where Essential Quantitative Methods 2nd edn © Les Oakshott 2001 Palgrave Publishers Ltd