[R] question: corCAR1 in lme

From: Sean Connolly <sean.connolly_at_jcu.edu.au>
Date: Wed 25 May 2005 - 19:07:18 EST


Hello all,

I am trying to use lme to examine how a response variable (Chla) changes over time in different treatments (2 Temp & 2 Light levels). Within each treatment combination, there are two replicate tanks (each with unique TankID) with coral fragments in them. All tanks are subject to the same environment until Time=0, when treatments are imposed, and Chla is measured for each tank at six times, including Time 0 just as the experiment commences. The model is:

Chla.1 <- lme(Chla ~ Temp*Light* Time - Temp*Light, random = ~1 | TankID, method="ML")

The reasoning here is that each tank’s intercept (Chla at Time 0) is a random draw from a common distribution regardless of treatment, but that the trend in Chla over time may vary among treatment combinations. Based on the help files, two separate threads from the archives, and the Pinheiro and Bates nlme 3.0 manual, I became confused about which of two ways to check for a first-order temporal autocorrelation:

Chla.1b <- lme(Chla ~ Temp*Light* Time - Temp*Light, random = ~1 | TankID, corr = corCAR1(form = ~Time | TankID), method="ML")

Chla.1c <- lme(Chla ~ Temp*Light* Time - Temp*Light, random = ~1 | TankID, corr = corCAR1(form = ~1 | TankID), method="ML")

Comparing these fits with inspection of plot(ACF(chla.model1),alpha=0.05) suggests to me that there are problems with both of my attempts. For the ACF plot, the correlation at lag 1 is about –0.3, and sticks out beyond the confidence limits. By contrast, the two models' correlation parameters are not negative (phi = +0.13 and ~0 respectively), and the log-likelihood values are identical to the original model, suggesting no evidence of autocorrelation. Our times are not equally spaced (they vary from 5-8 days apart), and I gather than ACF assumes they are, but my troubleshooting (summarized below) suggests to me that my problem is bigger than this. I think I have not used corCAR1 properly, and am hoping someone can point me in the right direction.

Attempted troubleshooting:

  1. To check whether the discrepancy between ACF and the lme fits was due entirely to the unequal spacing of measurements, I created a bogus time variable (Time2) that was equally spaced (running from 0 to 5 in steps of 1). I then re-fit all of the above models with Time2 replacing Time in the function calls, and get the same kinds of problems (phi ~ 0 in the model fits, while ACF plot suggests a negative correlation at lag 1).
  2. Still using the bogus equally-spaced time variable, I replaced corCAR1 with corAR1. Now, the two different specifications of “form” yield identical parameter estimates and MLLs; the estimates of phi agree with those from the ACF plot; and the models actually do fit better than the equivalent model without autocorrelation.

Any advice would be greatly appreciated.

Sincerely,
Sean Connolly

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed May 25 19:16:43 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:05 EST