[R] degrees of freedom in a LME model
Douglas Bates
bates at stat.wisc.edu
Mon Jun 30 18:32:19 CEST 2003
Federico Calboli <f.calboli at ucl.ac.uk> writes:
> Dear All,
>
> I am analysing some data for a colleague (not my data, gotta be published
> so I cannot divulge).
>
> My response variable is the number of matings observed per day for some
> fruitlies.
>
> My factors are:
> Day: the observations were taken on 9 days
> Regime: 3 selection regimes
> Line: 3 replicates per selection regime.
>
> I have 81 observations in total
>
> The lines are coded A to I, so I do not need to do any extra grouping.
>
> my model is:
>
> anova(lme(Matings ~ Day * Regime, random = ~1| Line/Day, mydata))
>
> I would expect to have:
> 1 df per Day
> 2 df per Regime
> 2 df per Day * Regime
> 6 df per Line %in% Regime
> 6 df per Day * Line %in% Regime,
>
>
> so my anova would have:
>
> numDF denDF
> int 1 63
> Day 1 6
> Regime 2 6
> D*R 2 6
>
> what I get is:
>
> numDF denDF
> int 1 69
> Day 1 69
> Regime 2 6
> D*R 2 69
>
> why is lme not calculating correctly the Line/Day interation ?
I think your calculation is based on using only within-strata
information whereas lme uses both within-strata and between-strata
information for estimates of effects.
The way that we calculate denominator degrees of freedom is described
on pp. 90-91 of Pinheiro and Bates (2000). For each term in the
fixed-effects we determine the innermost level of the random effects
at which is it changing. Because Regime is constant for each Line it
has the fewest degrees of freedom but Day is changing within Line so
terms in Day have more degrees of freedom. Is this what you intended?
I must admit I am having difficulty understanding the structure of the
experiment but it is still Monday morning for me so perhaps that is
not surprising.
> I am using R 1.7.0 under W2K, although I updated the packages and I get the
> warning "nlme lib built under R1.7.1..."
>
> Regards,
>
> Federico
--
Douglas Bates bates at stat.wisc.edu
Statistics Department 608/262-2598
University of Wisconsin - Madison http://www.stat.wisc.edu/~bates/
More information about the R-help
mailing list