lecture17 notes

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

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Stat 312: Lecture 17 Two sample t test Moo K. Chung mchung@stat.wisc.edu 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)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: F test to compare two variances ... p-value = 0.3975 alternative hypothesis: true ratio of variance s is not equal to 1 95 percent confidence interv a 0.02967475 3.42920369 sample estimates: ratio of variances 0.4417034 The Welch-Satterthwaite t test is an alternative to the two sample t-test with equal variance, and is used when the assumption that the two populations have equal variances seems unreasonable. The prob-lem with this method is that it is asymptotically a t distribution. &gt;t.test(x,y,alternative=&quot;two.sided&quot;, conf.level=0.9) Welch Two Sample t-test data:x and y t = -0.7073,df = 4.778 p-value = 0.5124 alternative hypothesis: true difference in means is not equal to 0 90 percent confidence interval:-20.361647 9.861647 Review problems. Compute a CI for X- Y in the previous Example. Example 9.7...
View Full Document

This note was uploaded on 01/31/2008 for the course STAT 312 taught by Professor Chung during the Fall '04 term at Wisconsin.

Ask a homework question - tutors are online