Li,Qinghong,ST.LOUIS,Molecular Biology
2006-Sep-07 21:07 UTC
[R] pairwise.t.test vs. t. test
Hi, If I set the p.adjust="none", does it meant that the output p values from the pairwise.t.test will be the same as those from individual t.tests (set var.equal=T, alternative="t")? I actually got different p values from the two tests. See below. Is it supposed to be this way? Thanks Johnny> x[1] 61.6 52.7 61.3 65.2 62.8 63.7 64.8 58.7 44.9 57.0 64.3 55.1 50.0 41.0 [15] 43.0 45.9 52.2 45.5 46.9 31.6 40.6 44.8 39.4 31.0 37.5 32.6 23.2 34.6 [29] 38.3 38.1 19.5 21.2 15.8 33.3 28.6 25.8> Grp[1] Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Med Med Med Med Med Med [19] Med Med Med Med Med Med Old Old Old Old Old Old Old Old Old Old Old Old Levels: Yng Med Old> pairwise.t.test(x=x,g=Grp,p.adjust.method="none")Pairwise comparisons using t tests with pooled SD data: x and Grp Yng Med Med 1.0e-06 - Old 2.0e-12 2.6e-05 P value adjustment method: none> t.test(x=x[1:12],y=x[25:36],var.equal=T, alternative="t")Two Sample t-test data: x[1:12] and x[25:36] t = 10.5986, df = 22, p-value = 4.149e-10 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 24.37106 36.22894 sample estimates: mean of x mean of y 59.34167 29.04167 [[alternative HTML version deleted]]
no, because the formula for the test statistics ( even assuming that variances are equal ) of the two different tests are different. in the pairwise t test, the pairwise differences are viewed as one sample so it turns into a one sample test. any intro stat book will have the formulas. mark ----- Original Message ----- From: "Li,Qinghong,ST.LOUIS,Molecular Biology" <Qinghong.Li at rdmo.nestle.com> To: <r-help at stat.math.ethz.ch> Sent: Thursday, September 07, 2006 5:07 PM Subject: [R] pairwise.t.test vs. t. test> Hi, > > If I set the p.adjust="none", does it meant that the output p values from > the pairwise.t.test will be the same as those from individual t.tests (set > var.equal=T, alternative="t")? > > I actually got different p values from the two tests. See below. Is it > supposed to be this way? > > Thanks > Johnny > >> x > [1] 61.6 52.7 61.3 65.2 62.8 63.7 64.8 58.7 44.9 57.0 64.3 55.1 50.0 41.0 > [15] 43.0 45.9 52.2 45.5 46.9 31.6 40.6 44.8 39.4 31.0 37.5 32.6 23.2 34.6 > [29] 38.3 38.1 19.5 21.2 15.8 33.3 28.6 25.8 >> Grp > [1] Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Med Med Med Med Med > Med > [19] Med Med Med Med Med Med Old Old Old Old Old Old Old Old Old Old Old > Old > Levels: Yng Med Old >> pairwise.t.test(x=x,g=Grp,p.adjust.method="none") > > Pairwise comparisons using t tests with pooled SD > > data: x and Grp > > Yng Med > Med 1.0e-06 - > Old 2.0e-12 2.6e-05 > > P value adjustment method: none > > >> t.test(x=x[1:12],y=x[25:36],var.equal=T, alternative="t") > > Two Sample t-test > > data: x[1:12] and x[25:36] > t = 10.5986, df = 22, p-value = 4.149e-10 > alternative hypothesis: true difference in means is not equal to 0 > 95 percent confidence interval: > 24.37106 36.22894 > sample estimates: > mean of x mean of y > 59.34167 29.04167 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
MARK LEEDS wrote:> no, because the formula for the test statistics ( even assuming that > variances are equal ) of the two different tests are different. in the > pairwise t test, the pairwise differences are > viewed as one sample so it turns into a one sample test. any intro stat book > will have the formulas. > > markActually, I think the difference is due to the SD being pooled across all 3 groups in the pairwise.t.test, but just 2 groups in t.test.> ----- Original Message ----- > From: "Li,Qinghong,ST.LOUIS,Molecular Biology" <Qinghong.Li at rdmo.nestle.com> > To: <r-help at stat.math.ethz.ch> > Sent: Thursday, September 07, 2006 5:07 PM > Subject: [R] pairwise.t.test vs. t. test > > >> Hi, >> >> If I set the p.adjust="none", does it meant that the output p values from >> the pairwise.t.test will be the same as those from individual t.tests (set >> var.equal=T, alternative="t")? >> >> I actually got different p values from the two tests. See below. Is it >> supposed to be this way? >> >> Thanks >> Johnny >> >>> x >> [1] 61.6 52.7 61.3 65.2 62.8 63.7 64.8 58.7 44.9 57.0 64.3 55.1 50.0 41.0 >> [15] 43.0 45.9 52.2 45.5 46.9 31.6 40.6 44.8 39.4 31.0 37.5 32.6 23.2 34.6 >> [29] 38.3 38.1 19.5 21.2 15.8 33.3 28.6 25.8 >>> Grp >> [1] Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Med Med Med Med Med >> Med >> [19] Med Med Med Med Med Med Old Old Old Old Old Old Old Old Old Old Old >> Old >> Levels: Yng Med Old >>> pairwise.t.test(x=x,g=Grp,p.adjust.method="none") >> Pairwise comparisons using t tests with pooled SD >> >> data: x and Grp >> >> Yng Med >> Med 1.0e-06 - >> Old 2.0e-12 2.6e-05 >> >> P value adjustment method: none >> >> >>> t.test(x=x[1:12],y=x[25:36],var.equal=T, alternative="t") >> Two Sample t-test >> >> data: x[1:12] and x[25:36] >> t = 10.5986, df = 22, p-value = 4.149e-10 >> alternative hypothesis: true difference in means is not equal to 0 >> 95 percent confidence interval: >> 24.37106 36.22894 >> sample estimates: >> mean of x mean of y >> 59.34167 29.04167 >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at stat.math.ethz.ch mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894
thanks. i assumed we we were talking about the standard textbook difference between the t test and pairwise t test. my bad. ----- Original Message ----- From: "Chuck Cleland" <ccleland at optonline.net> To: "MARK LEEDS" <markleeds at verizon.net> Cc: "Li,Qinghong,ST.LOUIS,Molecular Biology" <Qinghong.Li at rdmo.nestle.com>; <r-help at stat.math.ethz.ch> Sent: Thursday, September 07, 2006 6:44 PM Subject: Re: [R] pairwise.t.test vs. t. test> MARK LEEDS wrote: >> no, because the formula for the test statistics ( even assuming that >> variances are equal ) of the two different tests are different. in the >> pairwise t test, the pairwise differences are >> viewed as one sample so it turns into a one sample test. any intro stat >> book >> will have the formulas. >> >> mark > > Actually, I think the difference is due to the SD being pooled across > all 3 groups in the pairwise.t.test, but just 2 groups in t.test. > >> ----- Original Message ----- >> From: "Li,Qinghong,ST.LOUIS,Molecular Biology" >> <Qinghong.Li at rdmo.nestle.com> >> To: <r-help at stat.math.ethz.ch> >> Sent: Thursday, September 07, 2006 5:07 PM >> Subject: [R] pairwise.t.test vs. t. test >> >> >>> Hi, >>> >>> If I set the p.adjust="none", does it meant that the output p values >>> from >>> the pairwise.t.test will be the same as those from individual t.tests >>> (set >>> var.equal=T, alternative="t")? >>> >>> I actually got different p values from the two tests. See below. Is it >>> supposed to be this way? >>> >>> Thanks >>> Johnny >>> >>>> x >>> [1] 61.6 52.7 61.3 65.2 62.8 63.7 64.8 58.7 44.9 57.0 64.3 55.1 50.0 >>> 41.0 >>> [15] 43.0 45.9 52.2 45.5 46.9 31.6 40.6 44.8 39.4 31.0 37.5 32.6 23.2 >>> 34.6 >>> [29] 38.3 38.1 19.5 21.2 15.8 33.3 28.6 25.8 >>>> Grp >>> [1] Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Yng Med Med Med Med Med >>> Med >>> [19] Med Med Med Med Med Med Old Old Old Old Old Old Old Old Old Old Old >>> Old >>> Levels: Yng Med Old >>>> pairwise.t.test(x=x,g=Grp,p.adjust.method="none") >>> Pairwise comparisons using t tests with pooled SD >>> >>> data: x and Grp >>> >>> Yng Med >>> Med 1.0e-06 - >>> Old 2.0e-12 2.6e-05 >>> >>> P value adjustment method: none >>> >>> >>>> t.test(x=x[1:12],y=x[25:36],var.equal=T, alternative="t") >>> Two Sample t-test >>> >>> data: x[1:12] and x[25:36] >>> t = 10.5986, df = 22, p-value = 4.149e-10 >>> alternative hypothesis: true difference in means is not equal to 0 >>> 95 percent confidence interval: >>> 24.37106 36.22894 >>> sample estimates: >>> mean of x mean of y >>> 59.34167 29.04167 >>> >>> [[alternative HTML version deleted]] >>> >>> ______________________________________________ >>> R-help at stat.math.ethz.ch mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >> ______________________________________________ >> R-help at stat.math.ethz.ch mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > -- > Chuck Cleland, Ph.D. > NDRI, Inc. > 71 West 23rd Street, 8th floor > New York, NY 10010 > tel: (212) 845-4495 (Tu, Th) > tel: (732) 512-0171 (M, W, F) > fax: (917) 438-0894 >