Hi You need to use paired option> t.test(x=0:4, y=sample(5:9), paired=TRUE)$estimatemean difference -5 Cheers Petr> -----Original Message----- > From: R-help <r-help-bounces at r-project.org> On Behalf Of Samuel Granjeaud > IR/Inserm > Sent: Sunday, April 2, 2023 11:39 PM > To: r-help at r-project.org > Subject: [R] Should help of estimate in t.test be corrected? > > Hi, > > Not important, but IMHO the estimate component of the t.test holds an > estimate of mean of each group, never a difference. The doc says > "estimate the estimated mean or difference in means depending on whether > it > was a one-sample test or a two-sample test." > > > t.test(0:4)$estimate > mean of x > 2 > > t.test(0:4, 5:9)$estimate > mean of x mean of y > 2 7 > > Best, > Samuel > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.
Samuel Granjeaud IR/Inserm
2023-Apr-03 11:24 UTC
[R] Should help of estimate in t.test be corrected?
Hi Thanks for your feedback. I didn't think about that. Still, the mean difference is computed for paired, not because there are two samples. IMHO, the help should be updated. Best, Samuel Le 2023-04-03 ? 12:10, PIKAL Petr a ?crit?:> Hi > > You need to use paired option > >> t.test(x=0:4, y=sample(5:9), paired=TRUE)$estimate > mean difference > -5 > > Cheers > Petr > >> -----Original Message----- >> From: R-help <r-help-bounces at r-project.org> On Behalf Of Samuel Granjeaud >> IR/Inserm >> Sent: Sunday, April 2, 2023 11:39 PM >> To: r-help at r-project.org >> Subject: [R] Should help of estimate in t.test be corrected? >> >> Hi, >> >> Not important, but IMHO the estimate component of the t.test holds an >> estimate of mean of each group, never a difference. The doc says >> "estimate the estimated mean or difference in means depending on whether >> it >> was a one-sample test or a two-sample test." >> >> > t.test(0:4)$estimate >> mean of x >> 2 >> > t.test(0:4, 5:9)$estimate >> mean of x mean of y >> 2 7 >> >> Best, >> Samuel >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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.
Hallo, you are probably right that "the estimated mean or difference in means depending on whether it was a one-sample test or a two-sample test" should be rephrased to "the estimated mean or difference in means depending on whether it was a one-sample test, two-sample test or two sample paired test" Cheers Petr> -----Original Message----- > From: Samuel Granjeaud IR/Inserm <samuel.granjeaud at inserm.fr> > Sent: Monday, April 3, 2023 1:25 PM > To: PIKAL Petr <petr.pikal at precheza.cz>; r-help at r-project.org > Subject: Re: [R] Should help of estimate in t.test be corrected? > > Hi > > Thanks for your feedback. I didn't think about that. > > Still, the mean difference is computed for paired, not because there are two > samples. IMHO, the help should be updated. > > Best, > Samuel > > Le 2023-04-03 ? 12:10, PIKAL Petr a ?crit : > > Hi > > > > You need to use paired option > > > >> t.test(x=0:4, y=sample(5:9), paired=TRUE)$estimate > > mean difference > > -5 > > > > Cheers > > Petr > > > >> -----Original Message----- > >> From: R-help <r-help-bounces at r-project.org> On Behalf Of Samuel > >> Granjeaud IR/Inserm > >> Sent: Sunday, April 2, 2023 11:39 PM > >> To: r-help at r-project.org > >> Subject: [R] Should help of estimate in t.test be corrected? > >> > >> Hi, > >> > >> Not important, but IMHO the estimate component of the t.test holds an > >> estimate of mean of each group, never a difference. The doc says > >> "estimate the estimated mean or difference in means depending on > whether > >> it > >> was a one-sample test or a two-sample test." > >> > >> > t.test(0:4)$estimate > >> mean of x > >> 2 > >> > t.test(0:4, 5:9)$estimate > >> mean of x mean of y > >> 2 7 > >> > >> Best, > >> Samuel > >> > >> ______________________________________________ > >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > >> 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.