Introduction to GSEM in Stata

Similar documents
Generalized linear models

Description Remarks and examples Reference Also see

Using generalized structural equation models to fit customized models without programming, and taking advantage of new features of -margins-

Comparing IRT with Other Models

Description Remarks and examples Reference Also see

Truncation and Censoring

NELS 88. Latent Response Variable Formulation Versus Probability Curve Formulation

Generalized Linear Models for Non-Normal Data

Investigating Models with Two or Three Categories

Multilevel Statistical Models: 3 rd edition, 2003 Contents

Econometric Analysis of Cross Section and Panel Data

Class Notes: Week 8. Probit versus Logit Link Functions and Count Data

ECON 594: Lecture #6

Economics 113. Simple Regression Assumptions. Simple Regression Derivation. Changing Units of Measurement. Nonlinear effects

Applied Economics. Regression with a Binary Dependent Variable. Department of Economics Universidad Carlos III de Madrid

Dealing With and Understanding Endogeneity

Lecture 10: Alternatives to OLS with limited dependent variables. PEA vs APE Logit/Probit Poisson

EPSY 905: Fundamentals of Multivariate Modeling Online Lecture #7

Extended regression models using Stata 15

predict and adjust with logistic regression

ECON 482 / WH Hong Binary or Dummy Variables 1. Qualitative Information

Hierarchical Generalized Linear Models. ERSH 8990 REMS Seminar on HLM Last Lecture!

Generalized Multilevel Models for Non-Normal Outcomes

Longitudinal Data Analysis Using Stata Paul D. Allison, Ph.D. Upcoming Seminar: May 18-19, 2017, Chicago, Illinois

This manual is Copyright 1997 Gary W. Oehlert and Christopher Bingham, all rights reserved.

Applied Health Economics (for B.Sc.)

Recent Advances in the Field of Trade Theory and Policy Analysis Using Micro-Level Data

Chapter 9 Regression with a Binary Dependent Variable. Multiple Choice. 1) The binary dependent variable model is an example of a

Generalized Linear Models for Count, Skewed, and If and How Much Outcomes

Non-linear panel data modeling

Selection endogenous dummy ordered probit, and selection endogenous dummy dynamic ordered probit models

Linear Regression With Special Variables

Lab 3: Two levels Poisson models (taken from Multilevel and Longitudinal Modeling Using Stata, p )

Applied Econometrics Lecture 1

13.1 Causal effects with continuous mediator and. predictors in their equations. The definitions for the direct, total indirect,

Introducing Generalized Linear Models: Logistic Regression

ECON Interactions and Dummies

Chapter 11. Regression with a Binary Dependent Variable

5. Let W follow a normal distribution with mean of μ and the variance of 1. Then, the pdf of W is

Ron Heck, Fall Week 8: Introducing Generalized Linear Models: Logistic Regression 1 (Replaces prior revision dated October 20, 2011)

Categorical and Zero Inflated Growth Models

CENSORED DATA AND CENSORED NORMAL REGRESSION

Title. Description. Remarks and examples. stata.com. stata.com. methods and formulas for gsem Methods and formulas for gsem

CHAPTER 9 EXAMPLES: MULTILEVEL MODELING WITH COMPLEX SURVEY DATA

A Course in Applied Econometrics Lecture 14: Control Functions and Related Methods. Jeff Wooldridge IRP Lectures, UW Madison, August 2008

Problem 13.5 (10 points)

Identification and Estimation Using Heteroscedasticity Without Instruments: The Binary Endogenous Regressor Case

Semiparametric Generalized Linear Models

Review of Panel Data Model Types Next Steps. Panel GLMs. Department of Political Science and Government Aarhus University.

Economics 671: Applied Econometrics Department of Economics, Finance and Legal Studies University of Alabama

A Guide to Modern Econometric:

Description Remarks and examples Also see

Lecture 11/12. Roy Model, MTE, Structural Estimation

Generalized linear models

Control Function and Related Methods: Nonlinear Models

Generalized Linear Models. Last time: Background & motivation for moving beyond linear

Generalized Models: Part 1

Longitudinal Data Analysis Using SAS Paul D. Allison, Ph.D. Upcoming Seminar: October 13-14, 2017, Boston, Massachusetts

Path Analysis. PRE 906: Structural Equation Modeling Lecture #5 February 18, PRE 906, SEM: Lecture 5 - Path Analysis

Identification and Estimation Using Heteroscedasticity Without Instruments: The Binary Endogenous Regressor Case

Write your identification number on each paper and cover sheet (the number stated in the upper right hand corner on your exam cover).

PhD/MA Econometrics Examination January 2012 PART A

WISE International Masters

Ninth ARTNeT Capacity Building Workshop for Trade Research "Trade Flows and Trade Policy Analysis"

Limited Dependent Variables and Panel Data

8 Nominal and Ordinal Logistic Regression

AGEC 661 Note Fourteen

Exam D0M61A Advanced econometrics

REGRESSION RECAP. Josh Angrist. MIT (Fall 2014)

Discrete Choice Modeling

Joint Modeling of Longitudinal Item Response Data and Survival

Anders Skrondal. Norwegian Institute of Public Health London School of Hygiene and Tropical Medicine. Based on joint work with Sophia Rabe-Hesketh

Latent class analysis and finite mixture models with Stata

Stat 542: Item Response Theory Modeling Using The Extended Rank Likelihood

STA216: Generalized Linear Models. Lecture 1. Review and Introduction

Linear, Generalized Linear, and Mixed-Effects Models in R. Linear and Generalized Linear Models in R Topics

ECON3150/4150 Spring 2015

ECON2228 Notes 8. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 35

A simple alternative to the linear probability model for binary choice models with endogenous regressors

Jeffrey M. Wooldridge Michigan State University

Impact Evaluation Technical Workshop:

Lecture 3.1 Basic Logistic LDA

Models of Qualitative Binary Response

Regression with Qualitative Information. Part VI. Regression with Qualitative Information

Warwick Economics Summer School Topics in Microeconometrics Instrumental Variables Estimation

The Simple Linear Regression Model

Gibbs Sampling in Latent Variable Models #1

Generalized Linear Models and Exponential Families

A Journey to Latent Class Analysis (LCA)

Description Syntax for predict Menu for predict Options for predict Remarks and examples Methods and formulas References Also see


SEM with Non Normal Data: Robust Estimation and Generalized Models

Econometrics II. Seppo Pynnönen. Spring Department of Mathematics and Statistics, University of Vaasa, Finland

Econometrics I Lecture 7: Dummy Variables

Causal Inference with General Treatment Regimes: Generalizing the Propensity Score

Using Instrumental Variables to Find Causal Effects in Public Health

Econometrics I. Professor William Greene Stern School of Business Department of Economics 1-1/40. Part 1: Introduction

WISE MA/PhD Programs Econometrics Instructor: Brett Graham Spring Semester, Academic Year Exam Version: A

ECON5115. Solution Proposal for Problem Set 4. Vibeke Øi and Stefan Flügel

Chapter 1. Modeling Basics

Transcription:

Introduction to GSEM in Stata Christopher F Baum ECON 8823: Applied Econometrics Boston College, Spring 2016 Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 1 / 39

Generalized Structural Equation Modeling in Stata Generalized Structural Equation Modeling in Stata We now present an introduction to Stata s gsem command, which extends the facilities of the sem command to implement a broader set of applications of structural equation modeling: thus, generalized structural equation modeling. As gsem has many capabilities, we can only discuss a limited subset of its features and give some illustrations of its use. 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 Generalized Linear Model To understand Stata s extension of the SEM framework, we must introduce the concept of the Generalized Linear Model: something that has been a component of Stata for many years as the glm command. The generalized linear model (GLM) framework of McCullaugh and Nelder (1989) is common in applied work in biostatistics, but has not been widely applied in econometrics. It offers many advantages, and should be more widely known. 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 GLM estimators are maximum likelihood estimators that are based on a density in the linear exponential family (LEF). These include the normal (Gaussian) and inverse Gaussian for continuous data, Poisson and negative binomial for count data, for binary data (including and probit) and Gamma for duration data. 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 GLM estimators are essentially generalizations of nonlinear least squares, and as such are optimal for a nonlinear regression model with homoskedastic additive errors. They are also appropriate for other types of data which exhibit intrinsic heteroskedasticity where there is a rationale for modeling the heteroskedasticity. The GLM estimator ˆθ maximizes the log-likelihood Q(θ) = N [a (m(x i, β)) + b(y i ) + c (m(x i, β))] i=1 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) = µ = a (µ)/c (µ) and Var(y) = 1/c (µ). For the Poisson, a (µ) = 1, c (µ) = 1/µ, so E(y) = Var(y) = µ. GLM estimators are consistent provided that the conditional mean function is correctly specified: that E(y i x i ) = m(x i, β). If the variance function is not correctly specified, a robust estimate of the VCE should be used. 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. The link function essentially expresses the transformation to be applied to the dependent variable. Each family has a canonical link, which is chosen if not specified: for instance, family(gaussian) has default link(identity), so that a GLM with those two options would essentially be linear regression via maximum likelihood. The binomial family has a default link(), while the poisson and nbinomial families share link(log). However, a number of other combinations of family and link are valid: for instance, link(power n) is valid for all distributional families. 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 The GLM and the GSEM What, then, is Stata s Generalized Structural Equation Model, or gsem? Essentially, the combination of the sem modeling capabilities we have discussed thus far with the broader glm estimation framework, allowing us to build models that include latent variables as well as response variables that are not continuous measures. 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. In sem, responses are continuous and models are linear regression. In gsem, responses are continuous or binary, ordinal, count, or multinomial. Models are linear regression, gamma regression,, probit, ordinal, ordinal probit, Poisson, negative binomial, multinomial, and more. 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 We now consider a number of models that are supported by the SEM methodology. The first is the single-factor measurement model, in which we consider several observed variables as influencing a single latent factor, as we considered earlier. The difference is that we now allow for a generalized response, rather than assuming that the response is continuous, driven by Gaussian errors. This can be graphically represented: Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 10 / 39

The one-factor measurement model, generalized response X x1 x2 x3 x4 probit probit probit probit Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 11 / 39

The one-factor measurement model, generalized response In this model, we have four observed factors, each of which is a binary (pass/fail) outcome. The latent factor, being related to only binary measurements, will have different properties than a model based on continuous measurements. Thus, the errors are presumed to follow a distribution, and the GLM link function is the probit. Notice that those specifications show up in the graphical diagram. We may implement this model using gsem as: gsem (x1 x2 x3 x4 <-X), probit Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 12 / 39

The one-factor measurement model, generalized response If one or more of these measurements was continuous, we could use a different family and link for that part of the model. Say that measurement 4 was not only a pass/fail mark, but the score on a test. Then that equation would be fit with the gsem default of Gaussian errors and the Identity link. gsem (x1 x2 x3 <-X, probit) (s4<-x) Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 13 / 39

Logistic regression Logistic regression We could use gsem to fit a standard logistic regression, which is equivalent to the model in the GLM framework. The model here considers the probability of low birth weight as related to a number of observed factors about the mother s medical condition, weight, race, and smoking status. We may implement this model using gsem as: gsem (low <- age lwt i.race smoke ptl ht ui), where i.race is the standard factor variable notation, indicating that one race should be omitted and indicator variables created for each of the other race categories. Graphically: Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 14 / 39

Logistic regression age lwt 1b.race 2.race 3.race low smoke ptl ht ui Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 15 / 39

Ordered probit and ordered Ordered probit and ordered We can also use ordered probit or ordered 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 Ordered could also be used, yielding almost identical results, while making use of the logistic distribution rather than the Gaussian. Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 16 / 39

Ordered probit and ordered SciAtt ordinal ordinal ordinal ordinal y1 y2 y3 y4 probit probit probit probit Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 17 / 39

Tobit model Tobit model The Tobit regression model combines a binary outcome, which indicates censoring, and a continuous outcome for uncensored observations. Censoring may be from below, above or both. For instance, we may have a response to how much did you spend on a new car last year?, where responses of 0 indicate non-purchase. This may be implemented as: gsem mpg <- wgt, family(gaussian, lcensored(17)) where the lcensored option indicates that left-censoring at the value 17 is applied. Graphically: Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 18 / 39

Tobit model wgt Gaussian mpg identity ε 1 Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 19 / 39

Interval regression Interval regression Interval regression (as implemented by Stata s intreg) fits a model where the response lies in an interval, as described by two dependent variables. For instance, from a survey we may have the information that a worker s wage is between $10.00 and $11.99, or between $12.00 and $13.99. Those values would appear as the lower and upper limits in the interval regression. The GSEM implementation of this model can be represented as: gsem wage1 <- age c.age#c.age nev_mar rural school tenure, /// family(gaussian, udepvar(wage2)) 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

Interval regression age c.age#c.age nev_mar rural Gaussian wage1 identity ε 1 school tenure Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 21 / 39

Heckman selection model Heckman selection model The Heckman regression with selection, as implemented in heckman, can also be considered in the GSEM framework. This model deals with a continuous outcome that is observed only when another equation determines that the observation is selected, and the errors of the two equations are allowed to be correlated. Subjects often choose to participate in an event or medical trial or even the labor market, and thus the outcome of interest might be correlated with the decision to participate. Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 22 / 39

Heckman selection model The Heckman selection model can be recast as a two-equation SEM one linear regression (for the continuous outcome) and the other censored regression (for selection) and with a latent variable L added to both equations. The latent variable is constrained to have variance 1 and to have coefficient 1 in the selection equation, leaving only the coefficient in the continuous-outcome equation to be estimated. For identification, the variance from the censored regression will be constrained to be equal to that of the linear regression. Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 23 / 39

Heckman selection model This may be implemented as: gsem (wage <- educ age L) (selected <- married children educ age L@1, family(gaussian, udepvar(notselected))), var(l@1 e.wage@a e.selected@a) where the variable wage is only observed when the notselected variable is 0. The selected and notselected variables are complements. The variables married and children are assumed to only affect the probability of labor force participation, while educ and age are presumed to affect both LFP and the level of the wage for working women. Like Roodman s cmp, Stata considers missing values on an equation-by-equation basis, so the fact that wage is missing for non-working women is not a problem. Graphically: Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 24 / 39

Heckman selection model ε 1 a married children Gaussian selected identity 1 educ wage L 1 age ε 2 a Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 25 / 39

Endogenous treatment-effects model Endogenous treatment-effects model The treatment-effects model attempts to measure the effect of a treatment on a continuous outcome. For instance, we might hypothesize that belonging to a labor union has an effect on wages, and we want to measure the effect. This differs from the Heckman selection model in that here we observe the outcome the wage for all observations. The econometric problem is that those persons with certain characteristics, for instance, higher education, might be more or less likely to be treated. Thus, we must take account of the non-experimental nature of the data at hand, rather than merely regressing wage on union with controls. Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 26 / 39

Endogenous treatment-effects model We may implement this, similar to the Heckman model, with a latent variable related to the probability of being treated. Variables llunion and ulunion are complements, reflecting the observed union indicator. gsem (wage <- age grade i.smsa i.black tenure 1.union L) (llunion <- i.black tenure i.south L@1, family(gaussian, udepvar(ulunion))), var(l@1 e.wage@a e.llunion@a) Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 27 / 39

Endogenous treatment-effects model 1.south ε 1 a 1.black tenure Gaussian llunion 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

One-parameter IRT (Rasch) model One-parameter IRT (Rasch) model The GSEM framework may be used to implement Item Response Theory (IRT) models such as the Rasch model. In this example, we have eight binary measurements from a math test, and we want to generate a single latent factor, Math Ability, and evaluate how difficult each of the questions were. This can be done by constraining the effects of each observed variable on the latent factor to 1; the estimated intercepts then gauge difficulty. A link is used, as all of the observed variables follow a distribution. gsem (MathAb -> (q1-q8)@1), Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 29 / 39

One-parameter IRT (Rasch) model MathAb 1 b b b b b b b b q1 q2 q3 q4 q5 q6 q7 q8 Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 30 / 39

Two-level measurement model (multilevel, generalized response) 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), Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 31 / 39

Two-level measurement model (multilevel, generalized response) MathAb 1 c2 c3 c4 c5 c6 c7 c8 q1 q2 q3 q4 q5 q6 q7 q8 1 c2 c3 c4 c5 c6 c7 c8 school 1 Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 32 / 39

Two-factor measurement model (generalized response) Two-factor measurement model (generalized response) This two-factor measurement model contains two latent variables: one measuring Math Ability and a second measuring Math Attitude. While the observed variables related to Ability are pass/fail grades on an eight-question test, those underlying Math Attitude are Likert-scale variables, necessitating the use of an ordinal estimator. The two latent factors are assumed to be correlated. The code: gsem (MathAb -> q1-q8, ) /// (MathAtt -> att1-att5, o) Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 33 / 39

Two-factor measurement model (generalized response) ordinal ordinal ordinal ordinal ordinal att1 att2 att3 att4 att5 MathAtt MathAb q1 q2 q3 q4 q5 q6 q7 q8 Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 34 / 39

Full structural equation model (generalized response) Full structural equation model (generalized response) In the prior model, we allowed for (and estimated) a covariance between the two latent factors, Math Ability and Math Attitude. We now add a structural component to the model by assuming that there is a causal relationship between Math Attitude and Math Ability. This allows us to test a hypothesis regarding the way in which attitudes toward math may affect ability, as evidenced by the observed test scores. gsem (MathAb -> q1-q8, ) /// (MathAtt -> att1-att5, o) /// (MathAtt -> MathAb) As MathAb is now endogenous, an error term appears in the specification. Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 35 / 39

Full structural equation model (generalized response) ordinal ordinal ordinal ordinal ordinal att1 att2 att3 att4 att5 MathAtt MathAb ε 1 q1 q2 q3 q4 q5 q6 q7 q8 Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 36 / 39

Combined models (generalized responses) We now return to a framework similar to that implemented by Roodman s cmp. In this application, we combine a equation and a Poisson regression equation. The models the probability of low birthweight, while the Poisson counts the number of premature episodes of labor encountered by the mother. We posit a causal relationship between premature labor and low birth weight. gsem (low <- ptl age smoke ht lwt i.race ui, ) /// (ptl <- age smoke ht, poisson) Age, smoking status and an indicator of hypertension are assumed to affect both outcomes, where other controls only enter the equation. Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 37 / 39

Combined models (generalized responses) age smoke ht Poisson ptl log lwt 1b.race 2.race low 3.race ui Christopher F Baum (BC / DIW) Introduction to GSEM in Stata Boston College, Spring 2016 38 / 39

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