Re: [R] names() function and lmer()

From: Douglas Bates <bates_at_stat.wisc.edu>
Date: Sun 16 Jul 2006 - 02:29:23 EST

On 7/15/06, A.R. Criswell <rstatistics@gmail.com> wrote:
> Hello All,
>
> I would like to retrieve some of the results from the lmer(...)
> function in library lme4. If I run a model, say
>
> fm.1 <- lmer(y ~ 1 + (1 | x), data = dog)
>
> and try names(fm.1), I get NULL. Is there anyway to retrieve the information?

Yes.

The recommended way of retrieving information form a fitted model object like an lmer object is with extractor functions. See

?lmer-class

for a list of such methods. That help page also documents the slots in the object. The lmer class is an S4 class and uses typed slots instead of named components.

The str function displays the structure of pretty well any type of R object, including S3 classed objects or S4 classed objects. That is my favorite way of checking the structure of an object.

Please remember that it is risky to count on being able to reach in to an object and pull out slots or components and operate on them. The names and contents of slots are not guaranteed to stay constant. The lme4 and Matrix packages have been under development for a long time and should continue to be regarded as under development. When we change the internal representation we do change the extractor functions accordingly. It is a bug if an internal change causes an extractor function in the package to fail to return correct results. It is not a bug if an internal change causes your code that assumes a particular, obsolete representation to break.



R-help@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 Received on Sun Jul 16 02:37:32 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 16 Jul 2006 - 04:14:07 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.