1
$\begingroup$

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!

$\endgroup$
1
  • $\begingroup$ Treat the year as categorical variable and random intercept is enough (1|Plot). $\endgroup$
    – user158565
    Commented Dec 11, 2018 at 22:19

1 Answer 1

1
$\begingroup$

I always like view the equations implied by the R syntax. So let's start with the level 1 equation. In your model, this represents the average effect of time. You allow random effects though for your intercept and slope - which is basically saying that sure there is an overall effect of time (year) but the properties of change varying across each plot. (Side note I recommend giving 0 a meaningful value in your time variable. It gives your grand intercept meaning. Currently your (Intercept) is an estimate for Yield when Year is equal to 0, which does not occur in your data.

So in notation Raudenbush & Bryk (2002) notation you have:

$$ Yield_{ti}= \pi_{0i}+\pi_{1i}(Year_t - 1) + e_{ti} $$

I added the $- 1$ so as a way of noting that you should center the time variable at 0 It is fairly common practice in these linear growth models to center time at the initial time point, but there may be reasons to center at other time points.

Now we add in the level 2 equations.

$$ \pi_{0i} = \beta_{00}+\beta_{01}(Distance_i-\bar{Distance})+r_{0i} $$

In your model above, $\beta_{00} =$ 2.793 and $\beta_{01} =$ 0.524. Here is another place in the model where the value of centering becomes apparent again. It gives $\beta_{00}$ a more obvious interpretation. It is the predicted intercept in your model when Dist = mean(Dist). The coefficient $\beta_{01}$ then represents the expected change in the grand intercept as a function of a one-unit change in distance scores. If you had centered your time variable at 0, you can specifically tie this back to the expected difference in Yield score at the first year of observation as a function of Dist.

Now for the last equation implied by your model.

$$ \pi_{1i} = \beta_{10} + \beta_{11}(Distance_i-\bar{Distance}) + r_{1i} $$

As before, centering improves interpretation here as your estimate for $\beta_{10}$ would then represent the expected change in the Year slope for a plot with an average distance score. From your model, $\beta_{10} =$ -0.552 and $\beta_{11} =$ -0.143.

So all of this is to show how your variables in your model interact and the interpretations you can make from them. Those interpretations would be greatly helped if 0 in each of your variables has a meaning. There are two components to your top level model - an intercept and a slope with random effects. You then evaluate the degree to which your plot-level variable of Dist predicts changes in these top-level parameters.

$\endgroup$
3
  • $\begingroup$ Fantastic, thank you. A couple small items - "Dist" is disturbance, not distance, but irrelevant in the great answer. The lack of centering at 0 was because I was measuring after an initial disturbance that occurred before the experiment; However, I do understand the reasoning above for centering at 0, in order to interpret the effect of the predictors. To clarify, following the breakdown above, the effect of "Dist" itself would be indicated as having a significant effect on "Yield", but also a significant relationship for the interaction of "Year"? $\endgroup$
    – W_O
    Commented Dec 13, 2018 at 15:35
  • $\begingroup$ In the current configuration, the Dist value for a given plot predicts the random slope for each plot. Backing up briefly, in your model you have said that the effect of Year varies from plot to plot. That is the change associated with time is not constant. Dist is then used as a predictor of those varying Year slopes across plots. Another way of saying that is the effect of Year depends, in part, on the level of Dist - that is your interaction (it is a cross-level interaction in MLM terms). $\endgroup$ Commented Dec 13, 2018 at 16:08
  • $\begingroup$ Thank you again! That makes sense to me. This is what happens when you don't do stats for a few years after grad school. Playing mental catch up. $\endgroup$
    – W_O
    Commented Dec 13, 2018 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.