Hi, 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) -- View this message in context: http://r.789695.n4.nabble.com/Degrees-of-Freedom-for-lme-tp4522671p4522671.html Sent from the R help mailing list archive at Nabble.com.
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