[R] fixed effects anova in lme lmer

From: <toby909_at_gmail.com>
Date: Tue, 05 Jun 2007 19:11:17 -0700

Can lme or lmer fit a plain regular fixed effects anova? Ie a model without a random effect, or have there be at least one random effect in order for these functions to work?

Trying to run such, (1) without specifying a random effect produces an error, (2) specifying that there is no random effect does not produce the same output as an anova run in lm(); (2b) specifying that there is no random effect in lmer crashed R (division by zero, I think).

Just trying to see the connection of fixed and random effects anova in R. STATA gives me same results for both models up to the point where they differ.

Best Toby

dt1 =

summary(a1 <- lm(V1~factor(V2)-1, dt1))

summary(a1 <- lm(V1~factor(V2), dt1))

dt1$f = factor(dt1$V2)

summary(a2 <- lme(V1~f, dt1)) #1a

summary(a2 <- lme(V1~f, dt1, ~-1|f)) #2a anova(a2)

lmer(V1~f, dt1) #1b

lmer(V1~f+(-1|f), dt1) #2b

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. Received on Wed 06 Jun 2007 - 02:18:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 06 Jun 2007 - 03:31:50 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.