Re: [R] an error message with 't.test' with R under Unix

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Wed 13 Sep 2006 - 21:52:04 GMT

"Tao Shi" <shitao@hotmail.com> writes:

> Hi list,Could you please help me to explain the following error
 messages with 't.test' in R Unix 2.1.1?

This is completely unreadable! However, yes, there was at some point a bug where the LHS of model formulas was checked more rigorously than need be, using the same rules that apply to the RHS. This fact can be found in a recent NEWS file.

> I don't see it in R under Windows (R 2.3.0) or Unix (R2.3.1). Is it really due to the different R versions?Thanks,...TaoUnix session: (R.2.1.1)========================> R.version _ platform x86_64-unknown-linux-gnuarch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 1.1 year 2005 month 06 day 20 language R > t.test(extra ~ group, data = sleep) Welch Two Sample t-testdata: extra by group t = -1.8608, df = 17.776, p-value = 0.0794alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -3.3654832 0.2054832 sample estimates:mean in group 1 mean in group 2 !
> 0.75 2.33 > t.test((1:6)~rep(1:2,each=3))Error in terms.formula(formula[-3]) : invalid model formula in ExtractVars> t.test(2^(1:6)~rep(1:2,each=3))Error in terms.formula(formula[-3]) : invalid power in formula> t.test(2^extra ~ group, data = sleep)Error in terms.formula(formula[-3]) : invalid power in formulaUnix session: (R 2.3.1)============================> R.version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 3.1 year 2006 month 06 day 01 svn rev 38247 language R version.string Version 2.3.1 (2006-06-01)> t.test(1:6~rep(1:2,each
 =!
> 3)) Welch Two Sample t-testdata: 1:6 by rep(1:2, each = 3) t =
> -3.6742, df = 4, p-value = 0.02131alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -5.266958 -0.733042 sample estimates:mean in group 1 mean in group 2 2 5 Windows session:===========================> R.version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 3.0 year 2006 month 04 day 24 svn rev 37909 language R version.string Version 2.3.0 (2006-04-24)> help(t.test)> t.test(extra ~ group, data = sleep) Welch Two Sample t-testdata: extra by group t = -1.8608, df = 17.
 7!
> 76, p-value = 0.0794alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -3.3654832 0.2054832 sample estimates:mean in group 1 mean in group 2 0.75 2.33 > t.test(2^extra ~ group, data = sleep) Welch Two Sample t-testdata: 2^extra by group t = -1.6362, df = 10.718, p-value = 0.1308alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -18.641557 2.773344 sample estimates:mean in group 1 mean in group 2 3.448644 11.382751 > t.test(1:6~rep(1:2,each=3)) Welch Two Sample t-testdata: 1:6 by rep(1:2, each = 3) t = -3.6742, df = 4, p-value = 0.02131alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -5.266958 -0.733042 sample estimates:mean in group 1 mean in group 2 2 5
> _________________________________________________________________
> Use Messenger to talk to your IM friends, even those on Yahoo!
>
> 685ee3e858fe
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-help@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.
Received on Thu Sep 14 08:00:42 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 13 Sep 2006 - 22:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.