lecture17 notes - Stat 312 Lecture 17 Two sample t test Moo K Chung [email protected] November 9 2004 1 Let X1 Xn and Y1 Ym be two independent

Probability and Statistics for Engineering and the Sciences (with CD-ROM and InfoTrac )

• Notes
• PresidentHackerCaribou10582
• 1

This preview shows page 1 out of 1 page.

Stat 312: Lecture 17 Two sample t test Moo K. Chung [email protected] November 9, 2004 1. Let X 1 , · · · , X n and Y 1 , · · · , Y m be two indepen- dent samples from normal distributions with the same population variance, i.e. X i N ( μ X , σ 2 ) and Y j N ( μ Y , σ 2 ) . The pooled estimator of σ is S 2 p = ( n - 1) S 2 X + ( m - 1) S 2 Y n + m - 2 . The test statistic for testing H 0 : μ X = μ Y vs. H 1 : μ X 6 = μ Y T = ¯ X - ¯ Y - ( μ X - μ Y ) S p p 1 /n + 1 /m t n + m - 2 . Reject H 0 if | T | > t α/ 2 ,n + m - 2 . Example. A study was conducted to compare the weights of cats and dogs. Weights of cats: 20, 21, 35, 13, 21, 10. Weights of dogs: 31, 10, 20, 40. Assume normality and equal variance for both cats and dogs. Is there any difference between the weights of cats and dogs? > x<-c(20,21,35,13,21,10) > y<-c(31,10,20,40) > Sp<-sqrt((5*var(x)+3*var(y))/8) [1] 10.52824 > t=(mean(x)-mean(y))/(Sp*sqrt(1/5+1/3)) > t [1] -0.6827026 > qt(0.05,8) [1] -1.859548 2. Checking the equality of variance. This topic will be discussed later in detail. > var(x) [1] 75.2 > var(y) [1] 170.25 > var.test(x,y)