I am running a multilevel logistic regression using the glmer function from the lme4 package. I would like to rescale the variances using Hox (2010) method and for that I need to calculate the variance of the linear predictor but not sure how to do this in R.
Some context first, a thought experiment may help here. Imagine a null two level random intercepts model with no predictors, and which the level 2 variance is 0.35 (a VPC of 0.10). Now introduce an important level-1 predictor that has no strong level 2 component; it is ‘pure’ level 1 variable. As it is an important variable it should reduce the level 1 variance and leave the level 2 variance unchanged. But the level 2 variance is really scaled to the level 1 variance, the latter has gone down, but it cannot do so as it is fixed to 3.29. The consequence is that the level-2 variance will appear to go up to keep the relative scaling with the level 1 variance. Of the variance that remains a larger percentage must be at the higher level, as the level 1 value is fixed at 3.29. Sometimes this apparent increase is quite considerable if the level 1 predictor is an important one. In reality the matter is further complicated in that there may be an element of the level 1 variable that varies at the area level, and this might be reducing the level 2 variance but this is not showing as it is being swamped by the rise consequent on the explanatory power of the pure level-1 component of the variable. There is a final and important twist. As the level 2 variance increases the cluster-specific multilevel estimates can be expected to increase in absolute value; so that these constraints affect the fixed part estimates as well as the random part. In short, in generalised linear models, changes in estimates are in part substantive and in part a technical consequence of scaling to the unchangeable level 1 variance.
Hox proposes to rescale the effects of a model via a factor which is the total variance of the null model (intercept only, composed of of variance at level 1 which is constant at 3.29 and variance at level 2) divided by the total variance in the model with predictors at level 1 (composed of variance at level 1 which is constant at 3.29, variance at level 2, and variance of the linear predictor). The linear predictor can be calculated from predictions of the regression equation, e.g. z = -342 - 0.003*X1 - 0.02*X2 + 051*X3 and then I would need to obtain its variance.