»  Home »  Products »  Features »  Survey support for gsem
ORDER STATA

Survey support for generalized structural equation models


Highlights

  • Support for survey data in generalized structural equation models
    • Structural equation models (SEMs) with binary, count, ordinal, and survival outcomes
    • Multilevel SEMs
    • That is, for all models fit by Stata's gsem
  • Point estimates and standard errors adjusted for survey design
    • Sampling weights
    • Primary and secondary sampling units (and tertiary, etc.)
    • Stratification
    • Finite-population corrections
    • Weights at each stage of a multistage design for multilevel models
    • Linearized, bootstrap, jackknife, or BRR (balanced and repeated replications) standard errors (SEs) for one-level models
    • Linearized SEs for multilevel models

What's this about?

When analyzing complex survey data, we take into account the characteristics of the survey design—clustering, stratification, sampling weights, and finite-population corrections. We adjust both point estimates and standard errors for the design characteristics when fitting our model, in this case, a structural equation model.

Say we have a sample of employees from a large department store chain who have responded to a series of questions related to job satisfaction. We want to fit a confirmatory factor analysis (CFA) model that measures job satisfaction based on these items. If our data were collected by first sampling stores and then sampling employees within stores, we could adjust the results of our CFA model for this design.

Perhaps we are interested in fitting a multilevel mediation model evaluating whether the impact of one-on-one tutoring influences the relationship between math test scores in third grade and math test scores in fourth grade. We also believe that school-level characteristics might impact test scores and include a school-level random intercept in the model. If the data were collected by first sampling schools and then sampling students within schools, we could adjust the results of our multilevel mediation model for this design.

Throughout Stata, analyzing complex survey data is as simple as using svyset to declare aspects of the survey design and then adding the svy: to the estimation command for the model you want to fit. We can now use svyset and svy: when fitting multilevel structural equation models and structural equation models with binary, count, ordinal, and survival-time outcomes.

Let's see it work

Suppose we are interested in measuring students' attitudes toward math. Our data contain five variables, att1–att5, recording students' responses to various statements about mathematics, such as "skills taught in my math class will help me get a better job" and "I am able to learn new math concepts easily". Responses are coded one through five, with one indicating strong disagreement and five indicating strong agreement with the statement. We want to fit a one-factor CFA model using an ordinal probit model for each response. We name our latent variable MathAtt. If we had random (i.i.d.) data, we could fit the model by typing

. gsem (MathAtt -> att1 att2 att3 att4 att5), oprobit

However, we want to take into account the complex survey design used to collect these data. Schools were sampled first. Then, students were sampled within the selected schools. We have a weight variable, finalwt, that represents the inverse of the probability that a student was included in the sample. We can declare our survey design by typing

. svyset school [pweight=finalwt]

Then, we simply add svy: to gsem:

. svy: gsem (MathAtt -> att1 att2 att3 att4 att5), oprobit

(running gsem on estimation sample)

Survey: Generalized structural equation model

Number of strata =  1                                  Number of obs   =   200
Number of PSUs   = 20                                  Population size = 3,044
                                                       Design df       =    19
 ( 1)  [att1]MathAtt = 1
Linearized
Coefficient std. err. t P>|t| [95% conf. interval]
att1
MathAtt 1 (constrained)
att2
MathAtt .2428913 .1532488 1.58 0.129 -.077862 .5636446
att3
MathAtt -1.283867 .5589543 -2.30 0.033 -2.453771 -.1139618
att4
MathAtt -.5089193 .2367305 -2.15 0.045 -1.004402 -.0134366
att5
MathAtt .2481603 .1007167 2.46 0.023 .0373578 .4589629
/att1
cut1 -.7046296 .142031 -1.001904 -.4073554
cut2 -.2068581 .1057275 -.4281482 .014432
cut3 .1287857 .110864 -.1032552 .3608267
cut4 .7445942 .1244083 .4842045 1.004984
/att2
cut1 -.6431586 .1306698 -.9166536 -.3696637
cut2 -.1585246 .1123286 -.3936311 .0765819
cut3 .1706105 .1408954 -.1242869 .465508
cut4 .6947548 .1445658 .3921752 .9973345
/att3
cut1 -.630639 .1750242 -.9969688 -.2643092
cut2 -.0727809 .1085746 -.3000302 .1544684
cut3 .154453 .1202194 -.0971691 .4060751
cut4 1.030772 .2137564 .5833747 1.478169
/att4
cut1 -.4750218 .0950974 -.674063 -.2759807
cut2 .0044686 .0694254 -.1408404 .1497776
cut3 .3824299 .0972776 .1788255 .5860343
cut4 1.029592 .1657465 .6826802 1.376503
/att5
cut1 -.8782888 .1412208 -1.173867 -.5827102
cut2 -.3312157 .1197627 -.581882 -.0805494
cut3 -.0431914 .1173434 -.2887939 .2024112
cut4 .4275253 .0894405 .2403242 .6147264
var(MathAtt) .8034492 .327552 .3422787 1.88598

We find the details of our survey design at the top of the output, and the results are adjusted to account for the sampling weights and clusters (schools).

By the way, we could have specified this model and the sample design from Stata's SEM Builder (shown at the top of this page).

Let's see it work with multilevel models

gsem also fits multilevel models. For instance, we can add a school-level latent variable to our model above and fit a two-level CFA model.

Ignoring the survey nature of the data, we could fit this model with the following gsem:

. gsem (MathAtt Sch[school] -> att1 att2 att3 att4 att5), oprobit

We have added Sch[school], a latent variable that varies across schools but is constant within school.

As before, we can add svy: to gsem to account for the complex survey design. However, because this is a multilevel model, it is no longer sufficient to provide a single sampling weight. Instead, we need weights for each stage of the design. Here, wt_school is the inverse of the probability that a school is included in the sample, and wt_student is the inverse of the probability that a student is selected, conditional on the student's school being selected.

We can specify weights for both stages of our sampling design using svyset,

. svyset school, weight(wt_school) || _n, weight(wt_student)

and add svy: to gsem:

. svy: gsem (MathAtt Sch[school] -> att1 att2 att3 att4 att5), oprobit

(running gsem on estimation sample)

Survey: Generalized structural equation model

Number of strata =  1                                  Number of obs   =   200
Number of PSUs   = 20                                  Population size = 3,044
                                                       Design df       =    19

 ( 1)  [att1]Sch[school] = 1
 ( 2)  [att2]MathAtt = 1
Linearized
Coefficient std. err. t P>|t| [95% conf. interval]
att1
Sch[school] 1 (constrained)
MathAtt 4.547013 3.109392 1.46 0.160 -1.96102 11.05505
att2
Sch[school] 1.728014 1.640972 1.05 0.306 -1.706579 5.162607
MathAtt 1 (constrained)
att3
Sch[school] -.9951548 .7207122 -1.38 0.183 -2.503623 .5133133
MathAtt -5.660526 2.747733 -2.06 0.053 -11.4116 .0905456
att4
Sch[school] .3599666 .5269958 0.68 0.503 -.7430483 1.462981
MathAtt -2.424179 1.376544 -1.76 0.094 -5.305318 .4569601
att5
Sch[school] -1.139446 .4394704 -2.59 0.018 -2.059269 -.2196244
MathAtt 1.378945 1.072514 1.29 0.214 -.8658533 3.623744
/att1
cut1 -.7376896 .108338 -.9644436 -.5109357
cut2 -.2348684 .1003683 -.4449417 -.024795
cut3 .1027572 .1125034 -.1327152 .3382296
cut4 .7207281 .1296628 .4493407 .9921155
/att2
cut1 -.7180856 .1376486 -1.006187 -.4299839
cut2 -.2176143 .1171325 -.4627755 .027547
cut3 .1210331 .1396433 -.1712437 .41331
cut4 .6666128 .1166829 .4223928 .9108329
/att3
cut1 -.5948689 .1433317 -.8948656 -.2948722
cut2 -.045612 .1018909 -.2588721 .167648
cut3 .1779896 .1104374 -.0531586 .4091377
cut4 1.046028 .2065132 .6137911 1.478265
/att4
cut1 -.4906047 .1056234 -.7116769 -.2695324
cut2 -.0068969 .0722451 -.1581076 .1443138
cut3 .3750473 .1011828 .1632693 .5868253
cut4 1.029155 .1662702 .6811472 1.377162
/att5
cut1 -.87133 .1499944 -1.185272 -.5573882
cut2 -.3051857 .1116453 -.5388619 -.0715095
cut3 -.0071758 .1188522 -.2559364 .2415848
cut4 .4756524 .1023588 .2614129 .6898918
var(Sch[school]) .0301019 .03426 .00278 .3259466
var(MathAtt) .0385815 .0419968 .003953 .3765592

As with the previous example, point estimates and standard errors now appropriately account for the complex survey design.

Here is how the model looks when drawn and fit in the SEM Builder.

Although our examples above focus on CFA models, support for complex survey data is available for all models fit by gsem, including one-level and multilevel path models, structural equation models, growth curve models, and more.

Tell me more

Learn more about fitting models with survey data in Stata Structural Equation Modeling Reference Manual.

Stata

Shop

Support

Company


The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn YouTube Instagram
© Copyright 1996–2021 StataCorp LLC   •   Terms of use   •   Privacy   •   Contact us