Course 02402 Overview, Hypotheses Tests Concerning Two Means Introduction to Statistics Hypothesis test - a repetition 1 Hypothesis tests and confidence intervals Lecture 7: Chapter 7 and 8: Hypotheses Tests Concerning Power and sample size 2 Hypotheses Concerning Two Means Two Means (7.7-7.8,8.1-8-5) 3 Example 1 In general With known variance With unknown variance - large samples Per Bruun Brockhoff With unknown variance - small samples, normal assumption Example 1 - cont. DTU Informatics Confidence Interval for Difference between Two Means Building 305 - room 110 4 Danish Technical University Example 1 - cont. 2800 Lyngby – Denmark Example 2 Paired t-test e-mail: pbb@imm.dtu.dk 5 Example 2 - cont. R (R note 7) 6 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 1 / 40 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 2 / 40 Hypothesis test - a repetition Chapter 7 and 8: Hypotheses Tests Concerning Two Means Hypotheses The null hypothesis vs. the alternative hypothesis Hypotheses Tests (7.7-7.8,8.1-8.5) Tests and confidence intervals H 0 : µ = µ 0 Hypotheses tests for two means H 1 : µ � = µ 0 Randomization and pairing Note that the ’burden of proof’ is on H 0 . We either choose R to accept H 0 or to reject H 0 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 3 / 40 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 5 / 40
Hypothesis test - a repetition Hypothesis test - a repetition Tests of Hypotheses Hypotheses A couple of rules of thumb when formulating the When testing statistical hypotheses, two kinds of errors can hypothesis: occur: Use equal sign ’=’ in the null hypothesis when possible Type I: Rejection of H 0 when H 0 is true The alternative hypotheses should be the claim we wish Type II: Non-rejection of H 0 when H 1 is true to establish We define P ( Type I error ) = α The alternative hypothesis can either be one- or two-sided P ( Type II error ) = β two-sided: ’ � = ’ one-sided: ’ < ’ or ’ > ’ Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 6 / 40 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 7 / 40 Hypothesis test - a repetition Hypothesis test - a repetition Example: Formulation of the Hypotheses Example An ambulance company claims that on average it takes 20 What kind of errors can occur? minutes from a telephone call to their switchboard until an Type I: Reject H 0 when H 0 is true, that is we mistakenly ambulance is at the location. conclude that it takes longer than 20 minutes for the We have some measurements: ambulance to be on location 21 . 1 22 . 3 19 . 6 24 . 2 ... If our goal is to show that on average it takes longer than Type II: Not reject H 0 when H 1 is true, that is we 20 minutes, the null- and the alternative hypotheses are: mistakenly conclude that it takes 20 minutes for the H 0 : µ = 20 minutes ambulance to be on location H 1 : µ > 20 minutes Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 8 / 40 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 9 / 40
Hypothesis test - a repetition Hypothesis test - a repetition Choosing the Level of Significance α Hypotheses Tests in 4 Steps Formulate the hypotheses and choose the level of significance α (choose the "risk-level") The level of significance α is chosen according to the size of Type I error we are willing to accept. Calculate, using the data, the value of the test statistic A typical value is α = 5% Calculate the p-value using the test statistic If we want to reduce the probability of Type I error we choose a smaller α , e.g. α = 1% Compare the p-value and the level of significance and draw a conclusion Lower α means that it is more difficult to reject H 0 ∗ An alternative to (4) is to compare the test statistic to the critical value . Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 10 / 40 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 11 / 40 Hypothesis test - a repetition Hypothesis tests and confidence intervals Power and sample size The Connection between Hypotheses Tests and Confidence Power and sample size Intervals How to affect the error probabilities in hypothesis testing? We consider a (1 − α ) · 100% confidence interval for µ (for Change the level of significance α small n and unknown σ ): x − t α/ 2 · s x + t α/ 2 · s Take larger samples, that is bigger n ¯ √ n < µ < ¯ √ n The power of a test is defined as 1 − β The confidence interval corresponds to the acceptance area → Section 7.7 for H 0 when testing the hypotheses (with two-sided Necessary sample size, given the wanted power: alternative): � 2 � σ z β + z α n = H 0 : µ = µ 0 ( µ 0 − µ 1 ) H 1 : µ � = µ 0 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 12 / 40 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 14 / 40
Hypotheses Concerning Two Means Example 1 Hypotheses Concerning Two Means Example 1 Example 1 Example 1 A (secretaries) B (nurses) In a nutrition study it is desired to investigate if there is a 7.53 9.21 difference in the energy usage for different types of 7.48 11.51 (moderate physical demanding) work. In the study, the 8.08 12.79 energy usage of 9 secretaries and 9 nurses have been 8.09 11.85 measured. The secretaries are expected to have a sedentary 10.15 9.97 job while the nurses are expected to have a more physical 8.40 8.79 demanding job. The measurements are given in the 10.88 9.69 following table in MJ: 6.13 9.68 7.90 9.19 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 16 / 40 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 17 / 40 Hypotheses Concerning Two Means In general Hypotheses Concerning Two Means In general Hypotheses Concerning Two Means Formulation of Hypotheses Null hypothesis vs. alternative hypothesis (shown here as two-sided) We want to compare mean values of two samples H 0 : µ 1 − µ 2 = δ Sample 1: n 1 , ¯ X 1 and s 2 1 H 1 : µ 1 − µ 2 � = δ Sample 2: n 2 , ¯ X 2 and s 2 2 We either choose to accept H 0 or to reject H 0 (We are often interested in the test where δ = 0 ) Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 18 / 40 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 19 / 40
Hypotheses Concerning Two Means With known variance Hypotheses Concerning Two Means With known variance Calculating the Test Statistic Comparing to a Critical Value When testing hypotheses concerning two means, ( µ 1 and µ 2 ) for data that is assumed to be normal and σ 2 1 and σ 2 When testing hypotheses concerning two means, ( µ 1 and 2 are known, we have: µ 2 ) for data that is assumed to be normal and σ 2 1 and σ 2 2 Alternative Reject are known, the test statistic is: hypothesis null hypothesis if ( ¯ X 1 − ¯ µ 1 − µ 2 < δ Z < − z α X 2 ) − δ Z = µ 1 − µ 2 > δ Z > z α � σ 2 1 /n 1 + σ 2 2 /n 2 µ 1 − µ 2 � = δ Z < − z α/ 2 If H 0 is true, Z ∼ N (0 , 1 2 ) . From this the P-value of the or Z > z α/ 2 test can be found. Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 20 / 40 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 21 / 40 Hypotheses Concerning Two Means With unknown variance - large samples Hypotheses Concerning Two Means With unknown variance - large samples Calculating the Test Statistic Comparing to a Critical Value When testing hypotheses concerning two means, ( µ 1 and µ 2 ) for data that is assumed to be normal, σ 2 1 and σ 2 2 are When testing hypotheses concerning two means, ( µ 1 and unknown but the samples are large, we have: µ 2 ) for data that is assumed to be normal, σ 2 1 and σ 2 2 are Alternative Reject unknown but the samples are large, the test statistic is: hypothesis null hypothesis if Z = ( ¯ X 1 − ¯ µ 1 − µ 2 < δ Z < − z α X 2 ) − δ µ 1 − µ 2 > δ Z > z α � s 2 1 /n 1 + s 2 2 /n 2 µ 1 − µ 2 � = δ Z < − z α/ 2 If H 0 is true, Z ∼ N (0 , 1 2 ) . From this the P-value of the or Z > z α/ 2 test can be found. Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 22 / 40 Per Bruun Brockhoff (pbb@imm.dtu.dk) Introduction to Statistics, Lecture 7 Fall 2012 23 / 40
Recommend
More recommend