Course 02402 Overview, Hypotheses Concerning Means Introduction to Statistics Motivating Example 1 Hypotheses and tests of these 2 Lecture 6: Chapter 7: Hypothesis Test for means One- or Two-Sided Alternative (one-sample setup), 7.4-7.6 Errors in hypothesis testing Practical Hypothesis Test I 3 P-value Example 1 Per Bruun Brockhoff Practical Hypothesis Test II 4 Critical Value DTU Informatics Example 1- fortsat Building 305 - room 110 One-sample hypothesis test without "known” variance 5 Danish Technical University Large samples 2800 Lyngby – Denmark Small samples - normal distributed data e-mail: pbb@imm.dtu.dk Example 2 R (R note 7) 6 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 1 / 34 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 2 / 34 Motivating Example Hypotheses and tests of these Motivating Example Tests of Hypotheses We consider a parameter µ . A manufacturer of computer screens inform that a screen in average uses 83 W. Furthermore it can be assumed, that Often there will be a prior interest linked to a certain value the usage is normally distributed with a known variance of µ . Therefore we want to test, that is accept or reject, σ 2 = 4 2 (W) 2 . the hypothesis µ = µ 0 . A group of consumers wants to test the manufacturers Since the estimate of µ is subject to random variation it is claim and plan to make some measurements of power usage not reasonable to expect that µ = µ 0 even though they are for the given type of computer screens. the same. Formulate a null and alternative hypothesis. The question is then how to compare µ and µ 0 . Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 4 / 34 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 6 / 34
Hypotheses and tests of these Hypotheses and tests of these One- or Two-Sided Alternative Hypotheses One- or Two-Sided Alternative Two-sided alternative H 0 : µ = µ 0 Null hypothesis vs. alternative hypothesis H 1 : µ � = µ 0 H 0 : µ = µ 0 In the case of one-sided alternative, H 1 is either H 1 : µ � = µ 0 H 1 : µ < µ 0 We either choose to accept H 0 or to reject H 0 or H 1 : µ > µ 0 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 7 / 34 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 8 / 34 Hypotheses and tests of these One- or Two-Sided Alternative Hypotheses and tests of these Errors in hypothesis testing Tests of Hypotheses Errors in hypothesis testing When testing statistical hypotheses, two kind of errors can A couple of rules of thumb when formulating the occur: hypotheses: Type I: Rejection of H 0 when H 0 is true Type II: Non-rejection of H 0 when H 1 is true Use equal sign in the null hypothesis when possible We define The alternative hypothesis should be the claim we wish P ( Type I error ) = α to establish P ( Type II error ) = β Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 9 / 34 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 10 / 34
Hypotheses and tests of these Errors in hypothesis testing Hypotheses and tests of these Errors in hypothesis testing An analogy An analogy Which error can occur? A man is standing in a court of law accused of criminal activity. Type I: Reject H 0 when H 0 is true, that is the man is The null- and the the alternative hypotheses are: innocent but judged guilty ( α ) H 0 : The man is not guilty Type II: Not reject H 0 when H 1 is true, that is the man is H 1 : The man is guilty guilty but is acquitted ( β ) Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 11 / 34 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 12 / 34 Practical Hypothesis Test I Practical Hypothesis Test I Tests of Hypotheses in 4 Steps Tests of Hypotheses 1 Formulate the hypotheses and choose the level of Assume that the data (sample) is normal, that is significance α (choose the "risk-level") x 1 , ..., x n ∈ N ( µ, σ 2 ) OR: Large sample ( n > 30 ) 2 Calculate, using the data, the value of the test statistic We would like to test a null hypothesis about the mean, 3 Calculate the p-value using the test statistic e.g. H 0 : µ = µ 0 4 Compare the p-value and the level of significance and draw a conclusion where µ 0 is some value of interest. Dependent on what we want to establish, the alternative hypotheses is ∗ An alternative to (4) is to compare the test statistic to formulated and the level of significance α chosen. the critical value . Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 14 / 34 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 15 / 34
Practical Hypothesis Test I Practical Hypothesis Test I P-value Calculating the Test Statistic Calculating the P-Value We assume that we have formulated a null- and an The p-value of the test measures the difference between the alternative hypothesis and chosen the level of significance data and H 0 . α . Now we need to calculate the test statistic. When testing hypotheses concerning one mean for data When testing hypotheses concerning one mean for data that can be assumed to follow a normal distribution and that is assumed to follow a normal distribution and σ is known the p-value for the test statistic Z is achieved σ is known, the test statistic is: by looking up in the normal distribution (Table 3). ¯ If the p-value is smaller than α , H 0 is rejected X − µ 0 Z = σ/ √ n If the p-value is bigger than α , H 0 is accepted Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 16 / 34 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 17 / 34 Practical Hypothesis Test I Example 1 Practical Hypothesis Test I Example 1 Example 1 Example 1 12 measurements are performed: 82 86 84 84 92 83 93 80 83 84 82 86 A manufacturer of computer screens inform that a screen in From these measurements the mean usage is estimated to average uses 83 W. Furthermore it can be assumed, that ¯ X = 84 . 92 . the usage is normally distributed with a known variance σ 2 = 4 2 (W) 2 . Carry out the hypothesis test. Use a significance level of A group of consumers wants to test the manufacturers α = 1% claim and plan to make some measurements of power usage for the given type of computer screens. Formulate a null and alternative hypothesis. Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 18 / 34 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 19 / 34
Practical Hypothesis Test I Example 1 Practical Hypothesis Test II Critical Value Example 1 Comparing to a Critical Value: Instead of using the p-value we can compare the test statistic to a critical value, z α (or z α/ 2 in two-sided tests) When testing hypotheses concerning one mean for data that can be assumed to follow a normal distribution and σ is known, we have H 1 Reject H 0 if µ < µ 0 Z < − z α µ > µ 0 Z > z α µ � = µ 0 Z < − z α/ 2 or Z > z α/ 2 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 20 / 34 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 22 / 34 Practical Hypothesis Test II Example 1- fortsat One-sample hypothesis test without "known” variance Large samples Example I - now with critical value instead Calculating the Test Statistic When testing hypotheses concerning one mean for data that can be assumed to follow a normal distribution and σ is unknown, but the sample is large ( n > 30 ), the test statistic is: ¯ X − µ 0 Z = s/ √ n since Z ∼ N (0 , 1 2 ) the p-value for the test statistic Z is achieved by looking up in the normal distribution (Table 3). Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 23 / 34 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 6 Fall 2012 25 / 34
Recommend
More recommend