[R] anova statistics in lmer
Diego Vázquez
dvazquez at lab.cricyt.edu.ar
Mon May 15 17:52:52 CEST 2006
Dear list members,
I am new to R and to the R-help list. I am trying to perform a
mixed-model analysis using the lmer() function. I have a problem with
the output anova table when using the anova() function on the lmer
output object: I only get the numerator d.f., the sum of squares and the
mean squares, but not the denominator d.f., F statistics and P values.
Below is a sample output, following D. Bates' SASmixed example in his
paper "Fitting linear mixed models in R" (R-News 5: 27-30).
By reading the R-help archive, I see that this problem has come up
before (e.g., http://tolstoy.newcastle.edu.au/R/help/06/04/25013.html).
What I understand from the replies to this message is that this
incomplete output results from some unresolved issues with lmer, and
that it is currently not possible to use it to obtain full anova
statistics. Is this correct? And is this still unresolved? If so, what
is the best current alternative to conduct a mixed model analysis, other
than going back to SAS?
I would greatly appreciate some help.
Diego
----
Example using SASmixed "HR" data (see D. Bates, "Fitting linear mixed
models in R", R-News 5: 27-30)
> data("HR",package="SASmixed")
> library(lme4)
Loading required package: Matrix
Loading required package: lattice
Attaching package: 'lattice'
The following object(s) are masked from package:Matrix :
qqmath
> (fm1<-lmer(HR~baseHR+Time*Drug+(1|Patient),HR))
Linear mixed-effects model fit by REML
Formula: HR ~ baseHR + Time * Drug + (1 | Patient)
Data: HR
AIC BIC logLik MLdeviance REMLdeviance
788.6769 810.9768 -386.3384 791.8952 772.6769
Random effects:
Groups Name Variance Std.Dev.
Patient (Intercept) 44.541 6.6739
Residual 29.780 5.4571
number of obs: 120, groups: Patient, 24
Fixed effects:
Estimate Std. Error t value
(Intercept) 33.96209 9.93059 3.4199
baseHR 0.58819 0.11846 4.9653
Time -10.69835 2.42079 -4.4194
Drugb 3.38013 3.78372 0.8933
Drugp -3.77824 3.80176 -0.9938
Time:Drugb 3.51189 3.42352 1.0258
Time:Drugp 7.50131 3.42352 2.1911
Correlation of Fixed Effects:
(Intr) baseHR Time Drugb Drugp Tm:Drgb
baseHR -0.963
Time -0.090 0.000
Drugb -0.114 -0.078 0.237
Drugp -0.068 -0.125 0.236 0.504
Time:Drugb 0.064 0.000 -0.707 -0.335 -0.167
Time:Drugp 0.064 0.000 -0.707 -0.167 -0.333 0.500
> anova(fm1)
Analysis of Variance Table
Df Sum Sq Mean Sq
baseHR 1 745.99 745.99
Time 1 752.86 752.86
Drug 2 86.80 43.40
Time:Drug 2 143.17 71.58
--
Diego Vázquez
Instituto Argentino de Investigaciones de las Zonas Áridas
Centro Regional de Investigaciones Científicas y Tecnológicas
CC 507, (5500) Mendoza, Argentina
http://www.cricyt.edu.ar/interactio/dvazquez/
More information about the R-help
mailing list