[R] means comparison with seasonal time series?

Douglas G. Scofield d.scofield at umiami.edu
Fri Aug 22 15:40:57 CEST 2003

Dear R list,

I have a sequence of weekly observations of number of adults and larvae
in various size classes from a butterfly population living in a
subtropical area with pronounced wet and dry seasons.  Wet and dry
seasons are each defined 26 weeks long with fixed start and end dates.
The data span 103 weeks (two seasons each of wet and dry) with some
missing weeks.  What I would like to do is compare means of each type of
observation between wet and dry seasons ("Does the number of adults
observed vary by season?").  Not surprisingly there is pronounced
autocorrelation in the data, e.g.:

   dwtest(lm(numadults ~ week))


   DW = 0.2727, p-value = < 2.2e-16

Note that the effects of this autocorrelation extend across wet-dry and
dry-wet boundaries.

What would be a way to ask my questions in R?  It seems like I'd use
nlme and define a corStruct, but it's unclear to me how I'd do that.
I'm still learning R (and  statistics) so detailed answers would be most


Douglas Scofield                 Department of Biology 
d.scofield at umiami.edu            University of Miami
off: (305) 284-3778              P.O. Box 249118
fax: (305) 284-3039              Coral Gables, FL  33124-0421

More information about the R-help mailing list