# Interpreting the change in random effect variance over time in a GLMM

I am measuring the change in random effect (random intercept) over time by running models such as

glmer( bull~p1+p2+p3+p4+p5+(1|school),subset=(yr=2011),data=bull, family=binomial(link=logit))

using different subset=(yr=20??) for each year. In the comments to my other question, it was stated that another way to do this was to use dummy variables for each year, and specify them in the model as random slopes, thus:

glmer(bull~p1+p2+p3+p4+p5+(i1+i2+i3+i4+i5+i6-1|school),data=bull, family=binomial(link=logit))

where i1...i6 are the indicator variables of the different years. My question is: how is the output of this model to be interpreted in terms of the longitudinal change in random effects variance ?

-
Joe, the two are not exactly equivalent - in your first approach, the fixed effects are also allowed to vary by year. In the second one, they are not. I don't have time to give a detailed answer right this minute but I will later if you haven't already received one. I've also edited your title to something that I think more completely captures the spirit of your question - feel free to change it if you disagree. –  Macro Jun 14 '12 at 15:25
@Macro , thanks, that's fine, and yes, I understood that they are not exactly equivalent. I prefer the 2nd approach (if I can understand it!) because it avoids the problem of the fixed effects changing even though they don't change much (by the overlapping confidence intervals measure), and it seems more parsimonious. Even if it is not "better" I would still like to understand it. –  Joe King Jun 14 '12 at 15:34

glmer(bull~p1+p2+p3+p4+p5+(i1+i2+i3+i4+i5+i6-1|school),data=bull, family=binomial)


fits the binary logistic random effects model:

$$\log \left( \frac{p_{ij}}{1-p_{ij}} \right) = \beta_0 + \sum_{k=1}^{5} \beta_k x_{ijk} + \sum_{t=1}^{6} \eta_{jt} I_{t}$$

where

• $p_{ij}$ is the probability that subject $i$ in cluster $j$ responds with a '$1$', conditional on the covariates and random effects.
• $x_{ijk}$ is the value of covariate $k$ for subject $i$ in cluster $j$ (according to your code there are $5$ covariates).
• $\beta_0, ..., \beta_5$ are fixed effects regression coefficients
• $\eta_{jt}$ is the cluster $j$ random effect for year $t$
• $I_t$ is $1$ if the observation was taken in year $t$ and 0 otherwise (according to your code there are $6$ years)

We can see that the distribution of an observation taken in year $t$ is described by the model

$$\log \left( \frac{p_{ij}}{1-p_{ij}} \right)= \beta_0 + \sum_{k=1}^{5} \beta_k x_{ijk} + \eta_{jt}$$

Let $\sigma^{2}_{t} = {\rm var}(\eta_{jt})$ be the random effect variance for year $t$. Since this model allows that random effect variance to change over time, as indicated by the subscript $t$, the level of similarity between responses within the same cluster is also allowed to change over time. As I discussed in this answer, the value

$$P_{t} = \frac{ \sigma^{2}_{t} }{ \sigma^{2}_{t} + \pi^2/3}$$

is a measure of the how similar individuals sharing a cluster are, in terms of their responses, at year $t$.

Your model produces estimates, $\hat \sigma^{2}_{t}$, of the random effect variances - which you can use to calculate

$$\hat P_{t} = \frac{ \hat \sigma^{2}_{t} }{ \hat \sigma^{2}_{t} + \pi^2/3}$$

Plotting $\hat P_t$ vs. $t$ will give you an idea whether the (linear) dependencies are increasing, decreasing, remaining constant, etc. over time, which is gets directly to your question of how to interpret the output of this model.

If you're interested in testing for statistical significance of these changes over time you can compare the model fit above with the model

$$\log \left( \frac{p_{ij}}{1-p_{ij}} \right) = \beta_0 + \sum_{k=1}^{5} \beta_k x_{ijk} + \eta_j$$

which does not allow the within-cluster dependency to change over time. These can be compared using the Likelihood Ratio Test, where, under the null hypothesis that there is no change over time, twice the difference in the log-likelihoods of the two models will have a $\chi^2$ distribution with $5$ degrees of freedom (since you've deleted $5$ parameters to arrive at the smaller model). As long as $\sigma^{2}_{t}$ doesn't equal 0 for all $t$, and you're fitting this model with glmer (and thus the model is fit by maximum likelihood), this test should be fine to use here.

-