On May 3, 2010, at 9:41 AM, John Sorkin wrote:
> R 2.10.0
> windows XP
>
> I am trying to get the coefficients returned from lmer. Normally I
> would use the names function to get the objects returned by the
> function. This does not work in lmer, but it does for lm:
When you read the help page for lmer it refers your to the description
of "mer"-class where that help page tells you that it is an S4 object
and offers a wide variety of extractor method functions, including a
coef function. The str function would have shown you the slot names,
but at your level of knowledge, it would probably be safer to work
with the extractor/accessor functions. (I speak from sad experience.
The authors of that package know a lot more than either of us.)
--
David.>
> <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)
>> names(fm2)
> NULL
>
>> fitlm <- lm(Reaction ~ Days, sleepstudy)
>> names(fitlm)
> [1] "coefficients" "residuals" "effects"
"rank"
> [5] "fitted.values" "assign" "qr"
"df.residual"
> [9] "xlevels" "call" "terms"
"model"
>
> How does one know what is returned by lmer, and how does one access
> the various parts? I looked at the code for lmer, but at least on my
> level of R sophistication, the nature of the data returned in not
> clear.
>
> Thanks,
> John
>
>
> John David Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
> Confidentiality Statement:
> This email message, including any attachments, is for th...{{dropped:
> 6}}
>
> ______________________________________________
> R-help at r-project.org 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.
David Winsemius, MD
West Hartford, CT