[R-sig-ME] random effect syntax

John.Morrongiello at csiro.au John.Morrongiello at csiro.au
Thu Feb 14 23:27:33 CET 2013

Dear Thierry
Thank you very much for this clear explanation of the differences between the two random effect structures. Much appreciated!


-----Original Message-----
From: ONKELINX, Thierry [mailto:Thierry.ONKELINX at inbo.be] 
Sent: Thursday, 14 February 2013 10:03 PM
To: Morrongiello, John (CMAR, Hobart); r-sig-mixed-models at r-project.org
Subject: RE: random effect syntax

Dear John,

Let's consider first the difference between (site|year) and (1|year:site). Both define an effect for each site-year combination. But with (site|year) the effects of site can be correlated whereas (1|site:year) assumes that they are independent.

It's a bit more complicated when you add a random slope along age. In (age|year:site) the random slope along age and the random intercept are correlated with each other but not with site. With (age + site|year) now age and site are correlated and the correlation between age and the intercept is at the level of year instead of year:site. So you assume a different slope per year instead of per year:site combination.

Best regards,


ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25
1070 Anderlecht
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx at inbo.be

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-models-bounces at r-project.org] Namens John.Morrongiello at csiro.au
Verzonden: donderdag 14 februari 2013 6:11
Aan: r-sig-mixed-models at r-project.org
Onderwerp: [R-sig-ME] random effect syntax

Hi list

I was wondering if someone could explain to me the difference between two models in terms of their random effect structure? We have a datatset of repeated growth observations within 400 individuals (ID) from three sites. The growth of these individuals corresponds to different years and is thus a crossed random effect with ID. As we only have three sites, we are not treating it as a random effect, although we'd like to test whether the year-to-year growth variation is dependent on the site it comes from. We'd also like to test whether the growth~age relationship varies among years. Hence we have fit the following models:


I think that M2 is maybe nesting Year within site, whereas M1 is just allowing for by year adjustments to each site, but I'm not sure! Below is the random effects tables from the two models.

*Random effects output from M1:
AIC BIC logLik deviance REMLdev
 105 322  -16.4     -139    32.8
Random effects:
 Groups   Name         Variance Std.Dev. Corr
 FishID   (Intercept)  0.012636 0.1124
          c.(log(age)) 0.016178 0.1272   -0.052
 fYear    (Intercept)  0.000234 0.0153
          c.(log(age)) 0.011124 0.1055   0.494
          sitehcr      0.006363 0.0798   0.546  0.998
          sitepb       0.005130 0.0716   0.755  0.943 0.962
 Residual              0.044675 0.2114
Number of obs: 3115, groups: FishID, 392; fYear, 21

*Random effects output from M2:
AIC BIC logLik deviance REMLdev
 133 308  -37.6    -87.4    75.1
Random effects:
 Groups     Name         Variance Std.Dev. Corr
 FishID     (Intercept)  0.01249  0.1117
            c.(log(age)) 0.01641  0.1281   -0.058
 site:fYear (Intercept)  0.00314  0.0560
            c.(log(age)) 0.00979  0.0989   0.826
 Residual                0.04478  0.2116
Number of obs: 3115, groups: FishID, 392; site:fYear, 57

When I print the random effects, I get different values. For M1, there is a random intercept for each year and a corresponding 'adjustment' for each site. When plotted, there is very little difference among years for each site. For M2, I get a unique intercept for each year by site combination. When plotted, these show considerable among-site variation through time (which I think is a better reflection of the underlying data). However, a likelihood ratio test prefers M1, so a bit confused.

Thank you for your time


R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * * Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.

More information about the R-sig-mixed-models mailing list