2

I m running a mixed model for 2 treatments and I run these 2 scripts which gave me different results

mixedmRV19R<-lme(RH ~ Flax*Row, random = ~ 1 | Month/Day/Hour, 
data = RV19, na.action=na.exclude)

versus

mixedmRV19RR<-lme(RH ~ Flax*Row, random = ~ Month|Day|Hour,
data = RV19, na.action=na.exclude)

Can somebody help me to explain the difference between ~ 1 | Month/Day/Hour and ~ Month|Day|Hour and why it gave me different p-values results?

mixedmRV19
numDF denDF  F-value p-value
(Intercept)     1 27927 880.5146  <.0001
Flax            2 27927 329.7394  <.0001
Row             1 27927  86.1296  <.0001
Flax:Row        2 27927 513.4153  <.0001

mixedmRV19RR (Intercept) 1 29280 539.1302 <.0001 Flax 2 29280 23.4599 <.0001 Row 1 29280 0.8258 0.3635 Flax:Row 2 29280 14.5269 <.0001

thanks!

T.E.G.
  • 2,332

1 Answers1

1

You are estimating different models. For example, in the first case, you don't have random slopes, only random intercepts. Whereas in the second case, you have both random intercepts and slopes (e.g., Month). Below, you can see a simple example:

I use the data set provided by Finch et al. (2019) on their website (you can download the file here).

The first model (lme_fit1) is similar to your first specification. Here, our outcome is reading score (geread) and individuals are nested in classrooms nested in schools nested in corporations (we also have one individual level predictor, vocabulary score, gevocab):

lme_fit1 <- lme(geread ~ gevocab, random = ~1|corp/school/class, data=Achieve)

In the second model (lme_fit2), we have random slopes for corporations which does not really make sense in this context but I'll keep it for the example (a more sensible choice for random slope could be vocabulary scores):

lme_fit2 <- lme(geread ~ gevocab, random = ~corp|school|class, data=Achieve)

You can see how the results differ:

|                                         |   (1)   |   (2)   | 
|:----------------------------------------|--------:|--------:|
| (Intercept)                             |  2.061  |  1.973  | 
|                                         | (0.057) | (0.052) | 
| gevocab                                 |  0.507  |  0.530  | 
|                                         | (0.008) | (0.008) | 
| SD (Intercept class)                    |  0.303  |  0.109  | 
| SD (corp | schoolTRUE class)            |         |  0.109  | 
| Cor (Intercept~corp | schoolTRUE class) |         |  -0.789 | 
| SD (Observations)                       |  1.923  |  1.965  | 
| SD (Intercept corp)                     |  0.252  |         | 
| SD (Intercept school)                   |  0.077  |         | 
| Num.Obs.                                |  10320  |  10320  | 

You can see that we don't have random intercepts for corporations (SD (Intercept corp)) and schools (SD (Intercept school) ) in the second model. Instead we have random slopes for corporations (again, just for the sake of example). So, the term on the left side of the first vertical bar is treated as random slope.

The term schoolTRUE class is created by the second vertical bar in the random part of the model (i.e., ~corp|school|class). However, I couldn't find any explanation or example about its use. If you want to specify it, make sure that you understand what it does.


Finch, W. H., Bolin, J. E., & Kelley, K. (2019). Multilevel modeling using R (Second edition). CRC Press, Taylor & Francis Group.

T.E.G.
  • 2,332