echo 0
note This macro calculates the proportion of explained variance in
note multilevel logistic regression models
note with only random intercepts and no extrabinomial variance,
note and a logit link function,
note according to Snijders & Bosker (2012), formula (17.22), p. 306.
note predicted values by fixed part to c901
pred c901
note store variance of c901 in b1
aver c901 b1 b3 b2
calc b1 = b2*b2
note store sum of intercept variances in b2
note subtract 1, which is the constant used in MLwiN for level 1,
note add 3.2898681261780075 = pi^2/3,
sum c1096 b2
calc b2 = b2 - 1 + 3.289868
calc b3 = b1/(b1+b2)
echo 1
fixe
rand
note Modeled variance given as b1, unexplained variance as b2, proportion explained as b3
print b1 b2 b3
echo 0