Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Social Science Statistics Module I Gwilym Pryce Lecture 5 Introduction to Hypothesis Tests Slides available from Statistics & SPSS page of www.gpryce.com 1 Notices: • Register • Class Reps and Staff Student committee. Aims & Objectives • Aim – To introduce hypothesis testing • Objectives – By the end of this session, students should be able to: • Understand the 4 steps of hypothesis testing • Run hypothesis test on a mean from a large sample; • Run hypothesis test on a mean from a small sample; Plan: • 1. Statistical Significance • 2. The four steps of hypothesis testing • 3. Hypotheses about the population mean – 3.1 when you have large samples – 3.2 when you have small samples 1. Significance • Does not refer to importance but to “real differences in fact” between our observed sample mean and our assumption about the population mean • P = significance level = chances of our observed sample mean occurring given that our assumption about the population (denoted by “H0”) is true. • So if we find that this probability is small, it might lead us to question our assumption about the population mean. • I.e. if our sample mean is a long way from our assumed population mean then it is: – either a freak sample – or our assumption about the population mean is wrong. • If we draw the conclusion that it is our assumption re m that is wrong and reject H0 then we have to bear in mind that there is a chance that H0 was in fact true. • In other words, when P = 0.05 every twenty times we reject H0, then on one of those occasions we would have rejected H0 when it was in fact true. • Obviously, as the sample mean moves further away from our assumption (H0) about the population mean, we have stronger evidence that H0 is false. • If P is very small, say 0.001, then there is only 1 chance in a thousand of our observed sample mean occurring if H0 is true. – This also means that if we reject H0 when P = 0.001, then there is only one in a thousand chance that we have made a mistake (I.e. that we have been guilty of a “Type I error”) • There is a tradition (initiated by English scientist R. A. Fisher 1860-1962) of rejecting H0 if the probability of incorrectly rejecting it is 0.05. – If P 0.05 then we say that H0 can be rejected at the 5% significance level. – If P > 0.05, then, argued Fisher, the chances of incorrectly rejecting H0 are too high to allow us to do so. • the probability of a sample mean at least as extreme as our observed value occurring, will be determined not just by the difference between our assumed value of m, but also by the standard deviation of the distribution and the size of our sample. Type I and Type II errors: • P = significance level = chances of incorrectly rejecting H0 when it is in fact true. – Called a “Type I error” – So sig = Pr(Type I error) = Pr(false rejection) • If we accept H0 when in fact the alternative hypothesis is true – Called a “Type II error”. • On this course we shall be concerned only with Type I errors. 2. The four steps of hypothesis testing • Last week we looked at confidence intervals: – We established the range of values of the population mean for a given level of confidence • E.g. we are 90% confident that population mean age of HoHs in repossessed dwellings in the Great Depression lay between 32.17 and 36.83 years (s = 20). • Based on a sample of 200 with mean = 34.5yrs. • But what if we want to use our sample to test a specific hypothesis we may have about the population mean? • E.g. does m = 30 years? – If m does = 30 years, then how likely are we to select a sample with a mean as extreme as 34.5 years? – I.e. 4.5 years more or 4.5 years less than the pop mean? One tailed test: P = how likely we are to select a sample with mean age at least as great as 34.5? How do we find the proportion of sample means greater than 34.5? • Because all sampling distributions for the mean (assuming large n) are normal, we can convert points on them to the standard normal curve – e.g. for 34.5: z = (34.5 - 30)/(20/200) = 4.5 / 1.4 = 3.2 Two tailed test: 3. Steps to Hypothesis tests: • 1. Specify null and alternative hypotheses and say whether it’s a two, lower, or upper tailed test. • 2. Specify threshold significance level a and appropriate test statistic formula • 3. Specify decision rule (reject H0 if P < a) • 4. Compute P and state conclusion. P values for one and two tailed tests: • Use diagrams to explain how we know the following are true: – Upper Tail Test: population mean > specified value H1: m > m0 then P = Prob(z > zi) – Lower Tail Test: population mean < specified value H1: m < m0 then P = Prob(z < zi) – Two Tail Test: population mean specified value H1: m m0 then P = 2xProb(z > |zi|) Confidence Interval Find the 90% confidence interval of the population mean age 1. Choose the appropriate test statistic: Hypothesis Tests Test the hypothesis that the population mean age = 30 using a significance level of 0.1 1. Specify null and alternative hypothesis: 2. Specify the level of significance and the test statistic xi m * s zi m xi z s/ n n H0: m = 30 H1: m 30 Significance level: a = likelihood of Type I error that you are prepared to tolerate = Prob(Reject H0 when it is true) = 0.1 Test Statistic: n > 30, therefore we can us z: zc xi m s/ n = zc xi 30 s/ n i.e. we write the zc formula assuming that H0 is correct 2. Establish the value of z*: 3. Prob(-z*<z<z*) = 0.9 Area of tails = (0.1)/2 = 0.05 z* = 1.65 3. Calculate the confidence interval: m 34.5 1.65 20 200 = 45.5 2.33 Specify the decision rule: Reject H0 iff P (the calculated level of Type I error) is no greater than the tolerated level: i.e. Reject H0 iff P a (the smaller is P, the less risk involved in rejecting H0) 4. Compute P and state your conclusion: zc = 3.18 ; PProb(z < 3.18) Since P < a(i.e. , its safe to reject H0 Lower Tail Hypothesis Tests Test the hypothesis that the population mean age < ? using a significance level of a Upper Tail Hypothesis Tests Test the hypothesis that the population mean age > ? using a significance level of 0.1 1. 1. Specify null and alternative hypothesis: H0: m = ? H1: m < ? 2. Specify the level of significance and the test statistic Significance level: a = likelihood of Type I error that you are prepared to tolerate = Prob(Reject H0 when it is true) Test Statistic: If n > 30, we can us z: xi m s/ n H0: m = ? H1: m > ? 2. Specify the level of significance and the test statistic zc Specify null and alternative hypothesis: = zc Significance level: a = likelihood of Type I error that you are prepared to tolerate = Prob(Reject H0 when it is true) Test Statistic: If n > 30, we can us z: xi ? zc s/ n xi m s/ n = zc xi ? s/ n i.e. we write the zc formula assuming that H0 is correct i.e. we write the zc formula assuming that H0 is correct 3. 3. Specify the decision rule: Reject H0 iff P (the calculated level of Type I error) is no greater than the tolerated level: i.e. Reject H0 iff P a 4. Compute P and state your conclusion: PProb(z < zc) Note that zc will be negative if x m Specify the decision rule: Reject H0 iff P (the calculated level of Type I error) is no greater than the tolerated level: i.e. Reject H0 iff P a 4. Compute P and state your conclusion: PProb(z > zc) Note that zc will be positive if m x E.g. The obesity threshold for men of a particular height is defined as weighing over 187lbs; mean weight of men in your sample with this height is 190.5lbs, sd = 13.7lbs, n = 94. Are the men in your sample typically obese? • Test the hypothesis that the average man in the population is obese. • How do we write Step 1? • Because H1: m > m0 then P = Prob(z > zi) • So this is an Upper tailed test & we write: H0: m = 187lbs H1: m > 187lbs How do we write Step 2? (a and appropriate test statistic formula) • Large sample How do we write Step 3? How do we write Step 4? • The upper tail significance level is given by SIGZ_UTL = 0.00663 • What can we conclude from this? eg Test the hypothesis that male super heroes/villains tend to be c. six foot tall. • 1st you need to convert scale: 6ft = 182.88cm • 2nd you need to run descriptive stats on height to get the n, x-bar, and s: Descriptive Statistics N Height in cm Valid N (listwise) • n • xbar • s 29 29 Minimum 165 = 29 = 181.72cm = 8.701 Maximum 205 Mean 181.72 Std. Deviation 8.701 H_L1M n=(29) x_bar=(181.72) m=(182.88) s=(8.701). • Compare this output with that of the large sample 95% confidence interval & interpret: Hypotheses about the population mean when you have small samples • This is exactly the same as the large sample case, except that one uses the t-distribution provided that x is normally distributed. • Many statisticians use t rather than z even when the sample size is large since: (i) strictly speaking our approximation for the SE of the mean has a t rather than z distribution (ii) t tends towards the z distribution when n is large E.g. re-run the hypothesis test on height of super heroes using a t test: H_S1M n=(29) x_bar=(181.72) m=(182.88) s=(8.701). • How do the results differ, if at all? – N.B. the t-distribution tends to have fatter tails • The smaller the sample, the fatter the tails become. Reading & Exercises: • Confidence Intervals: – M&M section 6.1 and exercises for 6.1 (odd numbers have answers at the back) • Tests of Significance: – M&M section 6.2 and exercises for 6.2 • Use and Abuse of Tests: – M&M section 6.3 and exercises for 6.3 • *Power and inference as a Decision – Type I & II errors etc. – *optional