Search
   >> Home >> Products >> Features >> Overview >> Multilevel models with survey data

Multilevel models with survey data

Stata’s mixed command for fitting linear multilevel models supports survey data. Sampling weights and robust/cluster standard errors are available.

Sampling weights are handled differently by mixed than by other commands:

  1. Weights can (and should be) specified at every model level unless you wish to assume equiprobability sampling at that level.
  2. Weights at lower model levels need to indicate selection conditional on selection of the higher-level cluster and not merely indicate overall selection.
  3. 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.

See [ME] mixed and, in particular, section Survey data in that entry for all the technical details.

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.

. webuse pisa2000 (Programme for International Student Assessment (PISA) 2000 data) . mixed isei female high_school college one_for both_for test_lang > [pw=w_fstuwt] || id_school:, pweight(wnrschbw) pwscale(size) nolog Mixed-effects regression Number of obs = 2069 Group variable: id_school Number of groups = 148 Obs per group: min = 1 avg = 14.0 max = 28 Wald chi2(6) = 187.23 Log pseudolikelihood = -1443093.9 Prob > chi2 = 0.0000 (Std. Err. adjusted for 148 clusters in id_school)
  Robust
isei Coef. Std. Err. z P>|z| [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
  Robust
Random-effects Parameters Estimate Std. Err. [95% Conf. Interval]
id_school: Identity
sd(_cons) 5.890139 .7279 4.623113 7.50441
sd(Residual) 14.7898 .3793531 14.06466 15.55232

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.

As is the case with other commands, 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.

See [ME] mixed for more details.

Back to highlights

The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn Google+ Watch us on YouTube