Re: [R] fixed effects anova in lme lmer

From: Simon Blomberg <s.blomberg1_at_uq.edu.au>
Date: Wed, 06 Jun 2007 12:23:43 +1000

?gls in package nlme. It's like lme but with no random effects. But you can still model the variance-covariance properties of the data.

Simon.

On Tue, 2007-06-05 at 19:11 -0700, toby909_at_gmail.com wrote:
> 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 =
> as.data.frame(cbind(c(28,35,27,21,21,36,25,18,26,38,27,17,16,25,22,18),c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4)))
>
> summary(a1 <- lm(V1~factor(V2)-1, dt1))
> anova(a1)
>
> summary(a1 <- lm(V1~factor(V2), dt1))
> anova(a1)
>
> 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.

-- 
Simon Blomberg, BSc (Hons), PhD, MAppStat. 
Lecturer and Consultant Statistician 
Faculty of Biological and Chemical Sciences 
The University of Queensland 
St. Lucia Queensland 4072 
Australia

Room 320, Goddard Building (8)
T: +61 7 3365 2506 
email: S.Blomberg1_at_uq.edu.au 

The combination of some data and an aching desire for 
an answer does not ensure that a reasonable answer can 
be extracted from a given body of data. - John Tukey.

______________________________________________
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:53:34 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 - 04:31:38 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.