On 7/4/06, John Christie <jc at or.psychology.dal.ca>
wrote:> Hi,
> I have been having a tedious issue with lmer models with lots of
> factors and lots of levels. In order to get the basic information at
> the beginning of the print out I also have to generate these enormous
> tables as well. Is there a method command to leave off all of the
> effects and correlations? Or, do I have to go to string commands?
Depending on exactly which parts of the output you want it may be
easiest to obtain them from the result of summary applied to your
fitted model. Use str to determine the structure of the object then
extract the slots that you want.
Warning: This is a somewhat risky practice in that we don't guarantee
that the classes and slot names will remain constant. If there is an
extractor function that gives the result that you want it is much
safer to use that than to reach in to a structure and extract
individual slots or components. However, in this case I don't think
such an extractor exists.
As an example
> (fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
Linear mixed-effects model fit by REML
Formula: Reaction ~ Days + (Days | Subject)
Data: sleepstudy
AIC BIC logLik MLdeviance REMLdeviance
1753.628 1769.593 -871.8141 1751.986 1743.628
Random effects:
Groups Name Variance Std.Dev. Corr
Subject (Intercept) 612.090 24.7405
Days 35.072 5.9221 0.066
Residual 654.941 25.5918
number of obs: 180, groups: Subject, 18
Fixed effects:
Estimate Std. Error t value
(Intercept) 251.4051 6.8246 36.838
Days 10.4673 1.5458 6.771
Correlation of Fixed Effects:
(Intr)
Days -0.138> so <- summary(fm1)
> showClass(class(so))
Slots:
Name: isG methTitle logLik ngrps sigma coefs
Class: logical character logLik integer numeric matrix
Name: vcov REmat AICtab flist Zt X
Class: dpoMatrix matrix data.frame list dgCMatrix matrix
Name: y wts wrkres method useScale family
Class: numeric numeric numeric character logical family
Name: call cnames nc Gp XtX ZtZ
Class: call list integer integer dpoMatrix dsCMatrix
Name: ZtX Zty Xty Omega L RZX
Class: dgeMatrix numeric numeric list dCHMsuper dgeMatrix
Name: RXX rZy rXy devComp deviance fixef
Class: dtrMatrix numeric numeric numeric numeric numeric
Name: ranef RZXinv bVar gradComp status assign
Class: numeric dgeMatrix list list logical integer
Name: frame terms
Class: data.frame terms
Extends:
Class "summary.mer", directly
Class "lmer", directly
Class "mer", by class "summary.mer"
Class "mer", by class "lmer"> so at AICtab
AIC BIC logLik MLdeviance REMLdeviance
1753.628 1769.593 -871.8141 1751.986 1743.628> print(so at REmat, quote = FALSE)
Groups Name Variance Std.Dev. Corr
Subject (Intercept) 612.090 24.7405
Days 35.072 5.9221 0.066
Residual 654.941 25.5918