Lecture 9 Fundamentals of Hypothesis Testing (1): One-Sample Tests K. H. Hamed, Cairo University Lecture 9 – Slide 1 Outline • • • • • • • Hypothesis testing methodology Z test for the mean (σ known) P-value approach to hypothesis testing Connection to confidence interval estimation One-tail tests T test for the mean (σ unknown) Potential hypothesis-testing pitfalls and ethical considerations K. H. Hamed, Cairo University Lecture 9 – Slide 2 What is a Hypothesis? • A hypothesis is a claim (assumption) about the population parameter – Examples of parameters: • population mean • Population variance – The parameter must be identified before analysis K. H. Hamed, Cairo University Lecture 9 – Slide 3 The Null Hypothesis, H0 • States the assumption (numerical) to be tested – e.g.: The average number of children in Cairo Homes is at least three (H 0 : μ ≥ 3 ) • Is always – about a population parameter (e.g., H 0 : μ ≥ 3 ), – not about a sample statistic (e.g., H 0 : X ≥ 3 ) K. H. Hamed, Cairo University Lecture 9 – Slide 4 The Null Hypothesis, H0 (continued) • Begins with the assumption that the null hypothesis is true – Similar to the notion of innocent until proven guilty • Refers to the status quo (current state) • Always contains the “=” sign • May or may not be rejected K. H. Hamed, Cairo University Lecture 9 – Slide 5 The Alternative Hypothesis, H1 • Is the opposite of the null hypothesis – e.g.: The average number of children in Cairo homes is less than 3 ( H1 : μ < 3 ) • • • • Challenges the status quo Never contains the “=” sign May or may not be accepted Is generally the hypothesis that is believed (or needed to be proven) to be true by the researcher K. H. Hamed, Cairo University Lecture 9 – Slide 6 Hypothesis Testing Process • Mean number of accidents has been equal to 200 accidents per year. • It is claimed that a new traffic law has decreased the mean rate to less than 200 accidents per year. • A sample is taken and the sample mean as 180 accidents. x is calculated • The null hypothesis is rejected if there is a reason to believe that the calculated x = 180 is significantly different than the assumed 200 accidents per year. K. H. Hamed, Cairo University Lecture 9 – Slide 7 Reason for Rejecting H0 Sampling Distribution of X ... Therefore, we reject the null hypothesis that μ = 200. It is unlikely that we would get a sample mean of this value ... If H0 is true 180 μ = 200 K. H. Hamed, Cairo University X Lecture 9 – Slide 8 Level of Significance, α • Defines the region of unlikely values of the sample statistic if null hypothesis is true – Called rejection region of the sampling distribution • Is designated by α , (level of significance) – Typical values are 0.01, 0.05, 0.10 • Is selected by the researcher at the beginning • Provides the critical value(s) of the test K. H. Hamed, Cairo University Lecture 9 – Slide 9 Level of Significance and the Rejection Region α H0: μ ≥ 3 H1: μ < 3 H0: μ ≤ 3 H1: μ > 3 Rejection Regions 0 0 H0: μ = 3 H1: μ ≠ 3 Critical Value(s) α α/2 0 K. H. Hamed, Cairo University Lecture 9 – Slide 10 Errors in Making Decisions • Type I Error – Rejecting a true null hypothesis – Has serious consequences The probability of Type I Error is α • Called level of significance • Set by researcher • Type II Error – Failure to reject a false null hypothesis – The probability of Type II Error is β – The power of the test is (1 − β ) K. H. Hamed, Cairo University Lecture 9 – Slide 11 Result Probabilities The Truth Decision H 0 True H 0 False Do Not Reject H0 1- α Type II Error ( β ) Reject H0 Type I Error (α ) Power (1 - β ) K. H. Hamed, Cairo University Lecture 9 – Slide 12 Relationship Between Type I & II Errors If one reduces the probability of one error, the other increases (everything else is unchanged). K. H. Hamed, Cairo University Lecture 9 – Slide 13 How to Choose between Type I and Type II Errors • Choice depends on the cost of the errors • Choose smaller Type I Error when the cost of rejecting the maintained hypothesis is high – A criminal trial: convicting an innocent person • Choose larger Type I Error when you have an interest in changing the status quo – A decision in a startup company about a new piece of software K. H. Hamed, Cairo University Lecture 9 – Slide 14 Critical Values Approach to Testing • Convert sample statistic (e.g.: X ) to test statistic (e.g.: Z, t or F –statistic) • Obtain critical value(s) for a specified α from a table or computer – If the test statistic falls in the critical region, reject H0 – Otherwise do not reject H0 K. H. Hamed, Cairo University Lecture 9 – Slide 15 p-Value Approach • Convert Sample Statistic (e.g. X ) to Test Statistic (e.g. Z, t or F –statistic) • Obtain the p-value from a table or computer – p-value: Probability of obtaining a test statistic more extreme ( ≤ or ≥ ) than the observed sample value given H0 is true – Called observed level of significance • Compare the p-value with α – If p-value ≥ α , do not reject H0 – If p-value ≤ α , reject H0 K. H. Hamed, Cairo University Lecture 9 – Slide 16 General Steps in Hypothesis Testing e.g.: Test the assumption that the true mean number of of children in Cairo homes is at least three (σ Known) H0 :μ ≥ 3 1. State the H0 2. State the H1 H1 : μ < 3 3. Choose α =0.05 α n = 100 Z test 4. Choose n 5. Choose Test K. H. Hamed, Cairo University General Steps 6. Set up critical value(s) Lecture 9 – Slide 17 (continued) Reject H0 α -1.645 100 households surveyed 7. Collect data 8. Compute test statistic and p-value 9. Make statistical decision 10. Express conclusion Z Computed test stat =-2, p-value = .0228 Reject null hypothesis The true mean number of children in Cairo homes is less than 3 K. H. Hamed, Cairo University Lecture 9 – Slide 18 One-tail Z-Test for Mean (σ Known) • Assumptions – Population is normally distributed – If not normal, requires large samples – Null hypothesis has ≤ or ≥ sign only • Z test statistic X − μX X −μ = Z= σX σ/ n K. H. Hamed, Cairo University Lecture 9 – Slide 19 Rejection Region H0: μ ≤ μ0 H1: μ > μ0 H0: μ ≥ μ0 H1: μ < μ0 Reject H0 Reject H0 α α 0 Z Must Be Significantly Below 0 to reject H0 Z Z 0 Small values of Z don’t contradict H0 Don’t Reject H0 ! K. H. Hamed, Cairo University Lecture 9 – Slide 20 Example: One Tail Test Q. Does an average sample of irrigation water contain less than 368 ppm (mg/L) of TDS? A random sample of 25 water samples showed that X = 372.5. The water quality division has specified σ to be 15 mg/L. Test at the α = 0.05 level. H0: μ ≤ 368 H1: μ > 368 K. H. Hamed, Cairo University Lecture 9 – Slide 21 Finding Critical Value: One Tail What is Z given α = 0.05? Standardized Cumulative Normal Distribution Table (Portion) σZ =1 Z .95 α = .05 0 1.645 Z Critical Value = 1.645 .04 .05 .06 1.6 .9495 .9505 .9515 1.7 .9591 .9599 .9608 1.8 .9671 .9678 .9686 1.9 .9738 .9744 .9750 K. H. Hamed, Cairo University Lecture 9 – Slide 22 H0: μ ≤ 368 H1: μ > 368 Example Solution: One Tail Test Test Statistic: α = 0.5 Z= n = 25 Critical Value: 1.645 X −μ σ =1.50 n Decision: Reject Do Not Reject at α = .05 .05 Conclusion: 0 1.645 Z No evidence that true mean is more than 368 1.50 K. H. Hamed, Cairo University Lecture 9 – Slide 23 p -Value Solution p-Value is P(Z ≥ 1.50) = 0.0668 Use the alternative hypothesis to find the direction of the rejection region. P-Value =.0668 1.0000 - .9332 .0668 0 From Z Table: Lookup 1.50 to Obtain .9332 Z 1.50 Z Value of Sample Statistic K. H. Hamed, Cairo University Lecture 9 – Slide 24 p -Value Solution (continued) (p-Value = 0.0668) ≥ (α = 0.05) Do Not Reject. p Value = 0.0668 Reject α = 0.05 0 1.50 1.645 Z Test Statistic 1.50 is in the Do Not Reject Region K. H. Hamed, Cairo University Lecture 9 – Slide 25 Example: Two-Tail Test Q. Does an average irrigation water sample contain 368 mg/L of TDS? A random sample of 25 water samples showed X = 372.5. The company has specified σ to be 15 mg/L. Test at the α = 0.05 level. H0: μ = 368 H1: μ ≠ 368 K. H. Hamed, Cairo University Lecture 9 – Slide 26 Example Solution: Two-Tail Test H0: μ = 368 H1: μ ≠ 368 Test Statistic: Z= α = 0.05 n = 25 Critical Value: ±1.96 -1.96 372.5 − 368 = 1.50 15 25 Decision: Do Not Reject at α = .05 .025 0 1.96 1.50 σ = n Reject .025 X −μ Conclusion: No Evidence that True Mean is Not 368 Z K. H. Hamed, Cairo University Lecture 9 – Slide 27 p-Value Solution (p Value = 0.1336) ≥ (α = 0.05) Do Not Reject. p Value = 2 x 0.0668 Reject Reject α = 0.05 0 1.50 1.96 Z Test Statistic 1.50 is in the Do Not Reject Region K. H. Hamed, Cairo University Lecture 9 – Slide 28 t Test: σ Unknown • Assumption – Population is normally distributed – If not normal, requires a large sample • t test statistic with n-1 degrees of freedom – t= X −μ S/ n K. H. Hamed, Cairo University Lecture 9 – Slide 29 Example: One-Tail t Test Does an average irrigation water sample contain less than 368 mg/L of TDS? A random sample of 36 water samples boxes showed X = 372.5, and s = 15. Test at the α = 0.01 level. σ is not given H0: μ ≤ 368 H1: μ > 368 K. H. Hamed, Cairo University Lecture 9 – Slide 30 Example Solution: One-Tail H0: μ ≤ 368 H1: μ > 368 Test Statistic: t= α = 0.01 n = 36, df = 35 Critical Value: 2.4377 Decision: Do Not Reject at α = .01 Reject .01 0 2.4377 t35 1.80 X − μ 372.5 − 368 = = 1.80 S 15 n 36 Conclusion: No evidence that true mean is more than 368 K. H. Hamed, Cairo University Lecture 9 – Slide 31 p -Value Solution (p Value is between .025 and .05) ≥ (α = 0.01). Do Not Reject. p Value = [.025, .05] Reject α = 0.01 0 t 2.4377 35 Test Statistic 1.80 is in the Do Not Reject Region 1.80 K. H. Hamed, Cairo University Lecture 9 – Slide 32