Stata’s mixed for fitting linear multilevel models supports survey data. Sampling weights and robust/cluster standard errors are available.
Sampling weights are handled differently by mixed:
Weights can (and should be) specified at every model level unless you wish to assume equiprobability sampling at that level.
Weights at lower model levels need to indicate selection conditional on selection of the higher-level cluster and not merely indicate overall selection.
The scaling of weights at lower levels needs to be considered. Unlike a standard analysis where the scale of the sampling weights is not an issue (only their relative sizes matter), in multilevel models weight scales need to be made “consistent” across lower-level clusters.
We demonstrate using mixed to fit a two-level model for data from a two-stage sampling design with sampling weights at both stages. Schools were sampled at the first stage, students at the second.
isei |
Robust Coef. Std. Err. z P>|z| [95% Conf. Interval] [95% Conf. Interval] |
female | .59379 .8732886 0.68 0.497 -1.117824 2.305404 |
high_school | 6.410618 1.500337 4.27 0.000 3.470011 9.351224 |
college | 19.39494 2.121145 9.14 0.000 15.23757 23.55231 |
one_for | -.9584613 1.789947 -0.54 0.592 -4.466692 2.54977 |
both_for | -.2021101 2.32633 -0.09 0.931 -4.761633 4.357413 |
test_lang | 2.519539 2.393165 1.05 0.292 -2.170978 7.210056 |
_cons | 28.10788 2.435712 11.54 0.000 23.33397 32.88179 |
Random-effects Parameters |
Robust Estimate Std. Err. [95% Conf. Interval] |
id_school: Identity
var(_cons) |
34.69374 8.574865 21.37318 56.31617 |
var(Residual) | 218.7382 11.22111 197.8147 241.8748 |
In the above, we specified the student-level weights using standard Stata weight syntax [pw=w_fstuwt] and the school-level weights with the pweight(wnrschbw) option as part of the school random-effects equation. We also specified pwscale(size) to rescale the student-level weights using one of three available methods.
Sampling weights imply robust standard errors, and in the case of mixed, standard errors are clustered at the highest level (schools in this example) unless you specify otherwise.