[R] Extract Df under lme4

Chuck Cleland ccleland at optonline.net
Thu Jun 21 13:01:02 CEST 2007


George W. Gilchrist wrote:
> I need to extract the degrees of freedom and log likelihoods from a  
> series of mixed models computed using lmer/lme4. If I ask for logLik 
> (lmer.object), I get something like
>  > logLik(lmer.object)
> 'log Lik.' -177.1000 (df=10)
> 
> Can I easily get that df from there (or elsewhere) into an object?  
> Thank you for any ideas.

  The help page for logLik() suggests the following:

> library(lme4)

> fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)

> logLik(fm1)
'log Lik.' -871.8141 (df=5)

> attr(logLik(fm1), "df")
[1] 5

> George
> 
> ..................................................................
> George W. Gilchrist                           Email: gwgilc at wm.edu
> Director of Graduate Studies                 Phone: (757) 221-7751
> Department of Biology, Box 8795                Fax: (757) 221-6483
> College of William & Mary
> Williamsburg, VA 23187-8795
> http://gwgilc.people.wm.edu/
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894



More information about the R-help mailing list