[R-sig-ME] double repeated measures
Julie McIntyre
jpmcintyre at alaska.edu
Thu Aug 10 04:52:55 CEST 2017
Hello,
I am trying to fit a model to data that are recorded in a doubly-repeated
measures type design, and I'm having trouble with the syntax for lmer. The
response is a count representing the number of animals harvested at each of
six locations during a hunting season. Counts are recorded daily at each
location for a fixed period (about 45 days). In addition, the daily counts
at each location have been repeated themselves over several years (about
30). The dates of the counts are the same every year. Additional
covariates are measured on a daily basis.
Graphically, for all locations there is a clear trend in count by day, with
some year-to-year variation. There are also clear but weaker trends in
counts by year (for fixed day), with variation among locations. The
general shape of the trend changes quite a bit depending on the day (e.g.,
early vs. late in the season). That said, the main interest is in
understanding the influence of the covariates on harvest.
I believe the following code fits a random intercept and slope model to
daily counts within years, separately for each location. This model fits
well, and allows testing of the covariate effects (X1 and X2). However it
ignores the second layer of repetition and the trend in count by year,
within locations.
M1=lmer(log(Count+1)~X1+X2+Location+Day+(1+Day|Year), data=Harvest)
I would like to know the correct syntax to also include terms for the
repeated measurement by year, within locations. This model might be close,
but I'm just not certain:
M2=lmer(log(Count+1)~X1+X2+Day+(1+Day|Year/Location)+(1+Year|Location),
data=Harvest)
I'd appreciate any suggestions or advice. Thank you!
Julie McIntyre
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list