I've created an exmaple data set below to hopefully help answer a question in regards to a lme4 in R and measurements over time.
The data is 4 plots, measured over 4 years, with the dependent variable being "Yield". The first year, the level of disturbance ("Dist") was measured, and never changed over all three years.
I want to know if "Dist" was a significant predictor of Yield over the three years measured.
dat<-data.frame(Year=c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4),
Plot=c("P1","P2","P3","P4","P1","P2","P3","P4","P1","P2","P3","P4","P1","P2","P3","P4"),
Yield=c(8,12,20,2,6,6,7,1,1,2,2,1,0.5,1,1.5,0.5),
Dist=c(10,20,40,5,10,20,40,5,10,20,40,5,10,20,40,5))
As I understand it, using lme4 in R, I should be able to do as follows:
d1<-lmer(Yield ~ Dist*Year+(1+Year|Plot), data=dat)
And using the lmerTest package, determine the significance of each predictor:
library(lmerTest)
summary(d1)
Random effects:
Groups Name Variance Std.Dev. Corr
Plot (Intercept) 3.8282 1.9566
Year 0.2654 0.5152 -1.00
Residual 4.9637 2.2279
Number of obs: 16, groups: Plot, 4
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 2.73913 2.88665 2.32566 0.949 0.4305
Dist 0.52391 0.12524 2.32566 4.183 0.0403 *
Year -0.55217 0.96433 3.75418 -0.573 0.5995
Dist:Year -0.14322 0.04184 3.75418 -3.423 0.0295 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) Dist Year
Dist -0.813
Year -0.927 0.754
Dist:Year 0.754 -0.927 -0.813
Would I be correct in interpreting that this means at year 1, "Dist" was significant, and over time the effect of "Dist:Year" is significantly decreasing?
Thanks!