GSEMinstataintroduction
GSEMinstataintroduction
Christopher F Baum
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 1 / 39
Generalized Structural Equation Modeling in Stata
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 2 / 39
Generalized Structural Equation Modeling in Stata Generalized Linear Model
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 3 / 39
Generalized Structural Equation Modeling in Stata Generalized Linear Model
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 4 / 39
Generalized Structural Equation Modeling in Stata Generalized Linear Model
where m(x, β) = E(y |x) is the conditional mean of y , a(·) and c(·)
correspond to different members of the LEF, and b(·) is a normalizing
constant.
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 5 / 39
Generalized Structural Equation Modeling in Stata Generalized Linear Model
For instance, for the Poisson, where the mean equals the variance,
a(µ) = −µ and c(µ) = log(µ). Given definitions of these two functions,
the mean and variance are E(y ) = µ = −a0 (µ)/c 0 (µ) and
Var (y ) = 1/c 0 (µ). For the Poisson, a0 (µ) = 1, c 0 (µ) = 1/µ, so
E(y ) = Var (y ) = µ.
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 6 / 39
Generalized Structural Equation Modeling in Stata Generalized Linear Model
To use the GLM estimator, you must specify two options: the
family(), which defines the member of the LEF to be employed, and
the link(), which is the inverse of the conditional mean function. The
family option may be chosen as gaussian, igaussian,
binomial, poisson, nbinomial, gamma.
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 7 / 39
Generalized Structural Equation Modeling in Stata The GLM and the GSEM
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 8 / 39
Generalized Structural Equation Modeling in Stata The GLM and the GSEM
sem fits standard linear SEMs, and gsem fits generalized SEMs.
gsem also has the ability to fit multilevel mixed SEMs. Multilevel mixed
models refer to the simultaneous handling of group-level effects, which
can be nested or crossed. Thus you can include unobserved and
observed effects for subjects, subjects within group, group within
subgroup, ... , or for subjects, group, subgroup, ... This extends Stata’s
mixed framework.
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 9 / 39
Models supported by GSEM The one-factor measurement model, generalized response
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 10 / 39
Models supported by GSEM The one-factor measurement model, generalized response
x1 x2 x3 x4
probit probit probit probit
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 11 / 39
Models supported by GSEM The one-factor measurement model, generalized response
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 12 / 39
Models supported by GSEM The one-factor measurement model, generalized response
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 13 / 39
Models supported by GSEM Logistic regression
Logistic regression
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 14 / 39
Models supported by GSEM Logistic regression
age
lwt
1b.race
2.race
Bernoulli
low
3.race
logit
smoke
ptl
ht
ui
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 15 / 39
Models supported by GSEM Ordered probit and ordered logit
We can also use ordered probit or ordered logit models in the GSEM
framework to deal with variables, such as responses on a Likert scale,
where there is assumed to be an underlying factor, with ranges of that
latent variable ‘binned’ into observed discrete categories.
We may implement this model for a latent factor, relating attitudes
toward science in a pure measurement framework to four Likert sale
variables, as:
gsem (y1 y2 y3 y4 <- SciAtt), oprobit
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 16 / 39
Models supported by GSEM Ordered probit and ordered logit
SciAtt
y1 y2 y3 y4
probit probit probit probit
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 17 / 39
Models supported by GSEM Tobit model
Tobit model
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 18 / 39
Models supported by GSEM Tobit model
Gaussian
wgt mpg ε1
identity
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 19 / 39
Models supported by GSEM Interval regression
Interval regression
where wage1 would be the lower-limit values, and the udepvar option
specifies the variable containing the upper-limit values. Graphically:
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 20 / 39
Models supported by GSEM Interval regression
age
c.age#c.age
Gaussian
nev_mar
wage1 ε1
identity
rural
school
tenure
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 21 / 39
Models supported by GSEM Heckman selection model
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 22 / 39
Models supported by GSEM Heckman selection model
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 23 / 39
Models supported by GSEM Heckman selection model
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 24 / 39
Models supported by GSEM Heckman selection model
ε1 a
married Gaussian
selected
1
children identity
L
1
educ
wage
age
ε2 a
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 25 / 39
Models supported by GSEM Endogenous treatment-effects model
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 26 / 39
Models supported by GSEM Endogenous treatment-effects model
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 27 / 39
Models supported by GSEM Endogenous treatment-effects model
1.south
ε1 a
1.black Gaussian
llunion
tenure identity
1
age L
1
grade wage
1.smsa ε2 a
1.union
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 28 / 39
Models supported by GSEM One-parameter IRT (Rasch) model
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 29 / 39
Models supported by GSEM One-parameter IRT (Rasch) model
MathAb
1
b b b b b b b b
q1 q2 q3 q4 q5 q6 q7 q8
logit logit logit logit logit logit logit logit
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 30 / 39
Models supported by GSEM Two-level measurement model (multilevel, generalized response)
We consider the Math Ability problem, noting that students are nested
within schools. We include a latent variable at the school level to
account for possible school-by-school effects. This makes the
estimation problem into a multilevel model. In the graphical
representation, school shows up as a latent variable at the school
level.
gsem (MathAb M1[school] -> q1-q8), logit
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 31 / 39
Models supported by GSEM Two-level measurement model (multilevel, generalized response)
MathAb
1 c2 c3 c4 c5 c6 c7 c8
q1 q2 q3 q4 q5 q6 q7 q8
logit logit logit logit logit logit logit logit
c3 c4 c5 c6
1 c2 c7 c8
school1
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 32 / 39
Models supported by GSEM Two-factor measurement model (generalized response)
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 33 / 39
Models supported by GSEM Two-factor measurement model (generalized response)
MathAtt
MathAb
q1 q2 q3 q4 q5 q6 q7 q8
logit logit logit logit logit logit logit logit
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 34 / 39
Models supported by GSEM Full structural equation model (generalized response)
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 35 / 39
Models supported by GSEM Full structural equation model (generalized response)
MathAtt
MathAb ε1
q1 q2 q3 q4 q5 q6 q7 q8
logit logit logit logit logit logit logit logit
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 36 / 39
Models supported by GSEM Combined models (generalized responses)
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 37 / 39
Models supported by GSEM Combined models (generalized responses)
age
smoke
Poisson
ptl
ht
log
lwt
1b.race
Bernoulli
2.race low
logit
3.race
ui
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 38 / 39
Models supported by GSEM Additional models implemented in GSEM
Although we will not illustrate these models, the GSEM framework can
also be used to implement:
MIMIC model (generalized response)
Multinomial logistic regression
Random-intercept and random-slope models (multilevel)
Crossed models (multilevel)
and a number of others. See Stata’s [SEM] manual for details.
Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 39 / 39