[R-sig-ME] Specifying 'correct' degrees of freedom for within-subject factor in *nlme/lme* repeated measures ANOVA?
John Maindonald
john.maindonald at anu.edu.au
Sat Jul 28 13:45:44 CEST 2012
Hello -
I found it remarkably easy to dowload your data and reproduce your analysis.
Your efforts at making what you'd done thus easy to reproduce are to be
commended!
Compare your
> Pop.Model2<-lme(Pop~Site+Habitat*Discharge, random=~1|ChannelUnit,data=mydata)
> summary(Pop.Model2)
Linear mixed-effects model fit by REML
Data: mydata
AIC BIC logLik
640.1269 661.5583 -310.0635
Random effects:
Formula: ~1 | ChannelUnit
(Intercept) Residual
StdDev: 13.87812 29.8971
. . .
with:
> Pop.ModelD2<-lme(Pop~Site+Habitat*Discharge, random=~Discharge|ChannelUnit,data=mydata)
> summary(Pop.Model2)
Linear mixed-effects model fit by REML
Data: mydata
AIC BIC logLik
636.0179 661.7355 -306.009
Random effects:
Formula: ~Discharge | ChannelUnit
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 17.88118 (Intr)
Discharge 450.69768 -0.663
Residual 23.51211
. . .
I conclude that there is a very large random slope effect, The df
for testing the fixed effect (slope) of Discharge should then be 21,
not 42 as the nlme output suggests.
John Maindonald email: john.maindonald at anu.edu.au
phone : +61 2 (6125)3473 fax : +61 2(6125)5549
Centre for Mathematics & Its Applications, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
http://www.maths.anu.edu.au/~johnm
On 27/07/2012, at 5:55 AM, Stephanie Avery-Gomm wrote:
> Hello,
>
> I am using *nlme* to do a mixed effect repeated measures ANCOVA, with two
> additional fixed factors but a limited sample size. *I am seeking
> clarification on how to/if I should adjust the inflated degrees of freedom
> for a within-subject factor as a way of dealing with the temporal
> pseudoreplication. *I am not using lmer so I am not sure the FAQ or Bates
> discussion re: adjusting df in lme4/lmer applies (
> https://stat.ethz.ch/pipermail/r-help/2006-May/094765.html).*
>
> *More information: At 3 Sites on a river I measured fish Population in
> approximately 9 stream Channel Units. Each Channel Unit was classified as a
> Habitat, with three levels (Glide, Riffle, Pool). I sampled each Channel
> Unit 3 times over the course of the summer, each time taking a Discharge
> Measurement (thus the exact Discharge differs a little from Site to Site,
> and so is a continuous variable). I want to know if fish Population in
> stream habitats (Glides, Riffles, Pools) changes as discharge decreases
> over the summer, if there an interaction and if fish Populations differ
> between habitats or between sites?
>
> The model I have settled on looks like this:
> Pop.Model<-lme(Pop~Site+Habitat*Discharge, random=~1|ChannelUnit,
> correlation=corCAR1(),data=mydata)
>
> Inclusion of the three repeated measurements of Population in each Channel
> Unit results in temporal pseudoreplication *and the degrees of freedom for
> the within-subjects factor (Discharge) is 42, but I only have 26 Channel
> Units, so this is obviously inflated (should be 21). I read in The R Book
> (Crawley: *(Pg. 644,
> https://www.dropbox.com/s/4zqewxl44btqmzo/Crawley%20The%20R%20book.pdf*)
> that I can fix this by specifying the degrees of freedom. But how?*
> *
> Although I‚ve read a ton online, including Bates info re: SAS PROC Mixed
> versus R lmer and degrees of freedom I find that I am still quite confused.
> If anyone can offer specific advice on how I can adjust my degrees of
> freedom for the within-subjects factor in nlme or explain in accessible
> terms why I don‚t need to, I would be very grateful. *
>
> Just in case I haven't provided enough information, here is my data and r
> code.
> .csv file:
> https://www.dropbox.com/s/2ijgq74di3hmo8i/R.Help.csv
> .R file:
> https://www.dropbox.com/s/puj5maifxc2rfcg/R%20Help.R
> .doc with code & diagram:
> https://www.dropbox.com/s/29dtofc62t957co/R%20Help.doc
>
> Sincerely,
>
> Stephanie Avery-Gomm
> MSc. Candidate, Zoology Department
> University of British Columbia
>
>
> --
> --
> Stephanie Avery-Gomm
> Master's Candidate
> Zoology Department,
> University of British Columbia
> #4200-6270 University Blvd.
> Vancouver, B.C. V6T 1Z4
> Email: Stephanie.AveryGomm at gmail.com
> Cell: 778 322 3483
> Web: http://ca.linkedin.com/in/stephanieaverygomm
>
>
>
> --
> --
> Stephanie Avery-Gomm
> Master's Candidate
> Zoology Department,
> University of British Columbia
> #4200-6270 University Blvd.
> Vancouver, B.C. V6T 1Z4
> Email: Stephanie.AveryGomm at gmail.com
> Cell: 778 322 3483
> Web: http://ca.linkedin.com/in/stephanieaverygomm
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> 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