# Help with repeated measures regression (in R)

I have some small datasets (example data given below) where I am interested in describing relationships between $Y_1$ and $Y_2$ across a gradient $X$ at two time points (date = "early" & "late"). As you can see from the first plot below, with $Y_1$, there appears to be a general increasing trend over across $X$ with the early data (black points), but perhaps not with the late data (brown dots). With $Y_2$, there doesn't appear to be any relationship with $X$; however, there does seem to be a general decrease in $Y_2$ in the late data relative to the early data.

My question is what would be an appropriate analysis for these 2 situations? Please keep in mind that the same sites were sampled on two dates. Right now I am considering using mixed models (lmer, lme in R), but I am interested in your expert opinions. dat <- structure(list(Site = structure(c(1L, 1L, 2L, 2L, 3L, 3L, 4L,
4L, 5L, 5L, 6L, 6L), .Label = c("C1", "C2", "C3", "Q1", "Q2",
"Q3"), class = "factor"), date = structure(c(1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L), .Label = c("early", "late"), class = "factor"),
Y1 = c(52L, 33L, 50L, 39L, 57L, 45L, 45L, 30L, 37L, 33L,
45L, 41L), Y2 = c(10L, 4L, 7L, 4L, 7L, 4L, 9L, 3L, 8L, 4L,
8L, 4L), X = c(709.75, 709.75, 362, 362, 957.25, 957.25,
478, 478, 299.5, 299.5, 551.25, 551.25)), .Names = c("Site",
"date", "Y1", "Y2", "X"), row.names = c(NA, -12L), class = "data.frame")

• What you propose sounds quite reasonable. date, having only two levels, is not flexible enough to be incorporated as random effect, I would use it as fixed effect, possibly interacting term. Site having 6 levels seems to be adequate to represent and random effect grouping. That being said 12 data-points are quite small for 6 levels. I would be very careful on how to interpreter my findings. Given you have such a small sample I would propose using lme because you can specify more flexible covariance functions and encode some prior knowledge. (sample size worries me. Cross-validate.) – usεr11852 says Reinstate Monic Jul 18 '13 at 22:39
• Another thought: Are you using Y1 as fixed effect or not? I mean in the context of a model like : test_model <- lmer( Y2 ~ Y1 + X + date +(1|Site), data= dat). I don't use date as in interaction term in this model to keep it as frugal as possible. (Model selection would be a pain, with 12 points standard asymptotic properties for AIC probably will be quite questionable. - I don't work on small sample statistics but hopefully this will get your ball rolling.) – usεr11852 says Reinstate Monic Jul 18 '13 at 22:53
• Ok, thanks. This is what I had in mind prior to posting this question: m1 <- lmer(Y1 ~ X + (1|Site) +(1|date), data=all) m2 <- lmer(Y1 ~ X + (1|Site), data=all) anova(m1, m2) m3 <- lme(Y1 ~ X , random= ~1|Site, data=all) summary(m3) Of course, in this example, the ANOVa suggests that I can't get rid of the date random effect. – Patrick Jul 18 '13 at 22:56
• Obviously, that is just with Y1, Y2 is a separate interest. It should be obvious now that I need help specifying models and interpreting. – Patrick Jul 18 '13 at 22:59
• As I said using date, having only two levels, as a random effect is a bit "excessive" as you can't really see it is a Gaussian; if you use it as a fixed effect it will be more sound. I think you'll also find m0 <- lmer(Y1 ~ X + date + (1|Site)... being better in terms of LR tests. (As I said, whether or not standard log-ratio tests are applicable for this sample size is another question). Good luck! – usεr11852 says Reinstate Monic Jul 18 '13 at 23:14