[R-sig-ME] Wrong degrees of freedom in lmer model?

Sundar Dorai-Raj sdorairaj at gmail.com
Thu Apr 2 22:17:45 CEST 2009


The "-1" in your formula is removing the intercept, which is why you
have an extra degree of freedom for Targets. Remove this an it drops
to 3 df:

> model=lmer(log(Completion_Time)~Targets+DPS+(-1+Targets|Participant_ID)+(1|Block)+(1|Target_Displacement),data=master1)
> anova(model)
Analysis of Variance Table
        Df  Sum Sq Mean Sq  F value
Targets  3 138.469  46.156 217.9088
DPS      1   1.648   1.648   7.7824

HTH,

--sundar

On Thu, Apr 2, 2009 at 12:51 PM, Ryan Hope <rmh3093 at gmail.com> wrote:
> I am trying to use the lmer function to analyze the data from the
> thesis experiment. The response variable is a continuous variable,
> completion time. I have 2 fixed factors, number of targets (4-levels:
> 4,9,14,19) and displacement per second (DPS) (3-levels: 72.42, 84.99,
> 88.99). I also have 3 random variables, participants, block (which
> group the replicates of a combination of fixed factors), and target
> displacement. The R code that I am using is listed below:
>
> library(lme4)
> datafile="http://people.rit.edu/rmh3093/master1.csv"
> master1=read.table(datafile,header=T)
> master1$Targets=as.factor(master1$Targets)
> model=lmer(log(Completion_Time)~-1+Targets+DPS+(-1+Targets|Participant_ID)+(1|Block)+(1|Target_Displacement),data=master1)
> anova(model)
>
> Im not even sure if the lmer model I am using is 100% correct but it
> seems the best to based on what I've read on
> (http://www.let.uu.nl/~Hugo.Quene/personal/multilevel/jml2008/x24lmerlog.html).
> Anyway, I do not understand the degrees of freedom reported by the
> anova function based on my model (shown below):
>
> Analysis of Variance Table
>        Df Sum Sq Mean Sq    F value
> Targets  4  33393    8348 39411.3500
> DPS      1      2       2     7.7816
>
> Since there are 4 levels of the Target factor, shouldn't the Df for
> Targets be 3 not 4?
>
> -Ryan
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>




More information about the R-sig-mixed-models mailing list