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

Info icon This 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 [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)
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. >t.test(x,y,alternative="two.sided", 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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern