Stat 312: Lecture 15Two-samplettestMoo K. Chung[email protected]March 13, 2003Concepts1. Pooled sample variance:S2p=(n-1)S2X+ (m-1)S2Yn+m-2.2. LetX1,· · ·, XnandY1,· · ·, Ymbe two indepen-dent samples from normal distributions withthe same population variance. The test statis-tic for testingH0:μX=μYvs.H1:μX6=μYT=¯X-¯Y-(μX-μY)Spp1/n+ 1/m∼tn+m-2.RejectH0if|T|> tα/2,n+m-2.In-class problemsExample 1.A study was conducted to compare theweights of cats and dogs. Weights of cats: 20, 21,35, 13, 21, 10.Weights of dogs:31, 10, 20, 40.Assume that the population variance to be same forboth cats and dogs. Is there any difference betweenthe weights of cats and dogs?> x<-c(20,21,35,13,21,10)> y<-c(31,10,20,40)> sqrt((5*var(x)+3*var(y))/8) 10.52824> t=(mean(x)-mean(y))/(10.53*sqrt(1/5+1/3))> t -0.6827026> qt(0.05,8) -1.859548If you use R, it is very easy to do two sample hy-pothesis testing.>t.test(x,y,alternative="two.sided",var.equal=TRUE,conf.level=0.9)Two Sample t-testdata:x and y t = -0.7725, df = 8,p-value = 0.462 alternativehypothesis: true difference in means is not equal to
This is the end of the preview.
access the rest of the document.