[Rd] anova and intercept

Gabor Grothendieck ggrothend|eck @end|ng |rom gm@||@com
Mon Dec 26 13:49:45 CET 2022


Suppose we want to perform a paired test using the sleep data frame
with anova in R.  Then this works and gives the same p value as
t.test(extra ~ group, sleep, paired = TRUE, var.equal = TRUE)

   ones <- rep(1, 10)
   anova(lm(diff(extra, 10) ~ ones + 0, sleep)

This gives output but does not give an F test at all.

   ones <- rep(1, 10)
   anova(lm(diff(extra, 10) ~ 1, sleep)

Maybe there should be some way to force an F test to be produced for
the intercept in anova for consistency with t.test so that the second
code can be used.


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-devel mailing list