[R] Degrees of Freedom for lme.

Ben Bolker bbolker at gmail.com
Sun Apr 1 19:39:36 CEST 2012


SHouston <suzannehouston <at> gmail.com> writes:

> I am trying to run a linear mixed effect model on data.  I have 17
> longitudinal subjects and 36 single subjects, and this is the code I'm using
> (below).  So, INDEX1 is the column with brain volumns, and the predictors
> are gort and age, by time ID (time they were seen).  
> 
> I believe my data is set up the right way, but when I run it, I get DF for
> Intercept is 49, and DF for slope is 13?  Why?   
> 
> lme.gort=lme(Volume ~ GORT_FLUENCY+AGE, random = ~ 1 | TIMEID, data =
> subset(vol_data, INDEX1=='LH_FUSIFORM'), na.action=na.omit)
> 
>  
>  fit_vol_model1 <- function(df){
>      tryCatch(lme.gort <- lme(Volume ~ GORT_FLUENCY+AGE, 
>  random = ~ 1 | UID,
> data=df, na.action=na.omit), error=function(err) tag <<-1)
>      data.frame(Term = rownames(anova(lme.gort)), anova(lme.gort))
> +  }
>   models = list()
>   models$anova = ddply(vol_data, c("INDEX1"), fit_vol_model1)
>   summary(lme.gort)

  The rules according to which lme calculates degress of freedom
are on p. 91 of Pinheiro and Bates 2000 
(also on Google Books, <http://tinyurl.com/ntygq3>).  You should
be able to work it out from there ...  (It's not actually clear
what your question was -- are you wondering why you have different
df for different effects?)

  Follow-ups should probably go to r-sig-mixed-models <at> r-project.org



More information about the R-help mailing list