# [R-sig-ME] anova() and the difference between (x | y) and (1 | y:x) in lme4

Hans Ekbrand hans.ekbrand at gmail.com
Wed Jun 11 23:16:51 CEST 2014

```On Wed, Jun 11, 2014 at 10:38:38AM -0400, Ben Bolker wrote:
> On 14-06-11 10:21 AM, ONKELINX, Thierry wrote:
> > Dear Hans,
> >
> > I assume that var1 is a factor variable.
> >
> > The difference is in the distribution of the random effects.
> >
> > (1|var1:var2) : all random intercept come from the same univariate normal distribution rnorm(mean = 0, sd = sigma)
> > (0 + var1|var2): the random intercepts come from a multivariate normal distribution: rmvnorm(mean = 0, sigma = Sigma). Sigma is a positive definite matrix
> >
> > (0 + var1|var2) is a bit easier to understand because the BLUP's have the same interpretation of those of (1|var1:var2)
> >
> > The bottom-line is that (var1|var2) and (1|var1:var2) allow the same model fit but (var1|var2) makes less assumptions at the cost of estimation more parameters. (var1|var2) requires n * (n + 1) / 2 parameters, with n = number of levels of var1. (1|var1:var2) requires just 1 parameter.

[...]

>   (2) the 'unstructured' (var1|var2) and 'grouped/positive compound
> symmetry' models (1|var1:var2) are in principle nested (all
> off-diagonals equal to zero, all diagonals identical -> simpler model),
> so you should be able to use a likelihood ratio test/ANOVA to test.

Would that hold even if I include a random intercept term for var2 (=country)
in the 'grouped/positive compound symmetry' model?

below.poverty.line ~ 1 + employment.type + (1 | country:employment.type) + (1 | country) + gender + age + age.2 + n.adults.minus.n.children + n.children + education + household.type

> anova(fit.hierarchical, fit.flat.plus.random.intercept)
Data: my.df
Models:
fit.flat.plus.random.intercept: below.poverty.line ~ 1 + employment.type + (1 | country:employment.type) +
fit.flat.plus.random.intercept:     (1 | country) + gender + age + age.2 + n.adults.minus.n.children +
fit.flat.plus.random.intercept:     n.children + education + household.type
fit.hierarchical: below.poverty.line ~ 1 + employment.type + (employment.type |
fit.hierarchical:     country) + gender + age + age.2 + n.adults.minus.n.children +
fit.hierarchical:     n.children + education + household.type
Df   AIC   BIC logLik deviance  Chisq Chi Df Pr(>Chisq)
fit.flat.plus.random.intercept 19 38808 38988 -19385    38770
fit.hierarchical               38 38804 39163 -19364    38728 42.161     19   0.001686 **

```