Stata SEM Path Specification

Stata has a custom syntax for specifying SEM paths.


Default and Implicit Behaviors

The path interpretter aggregates paths. The following two are equivalent.

... (X -> x1 x2 x3 x4 x5) ///
    (Y -> x1 x2 x3 x6 x7)

... (X -> x1) (X -> x2) (X -> x3) (X -> x4) (X -> x5) ///
    (Y -> x1) (Y -> x2) (Y -> x3) (Y -> x6) (Y -> x7)

Error variables are implicitly inserted for all endogenous variables, with the loading fixed at 1. The following three are equivalent.

... (x1 <- X) (x2 <- X) (x3 <- X) (x4 <- X)

... (x1 <- X e.x1) ///
    (x2 <- X e.x2) ///
    (x3 <- X e.x3) ///
    (x4 <- X e.x4)

... (x1 <- X e.x1@1) ///
    (x2 <- X e.x2@1) ///
    (x3 <- X e.x3@1) ///
    (x4 <- X e.x4@1)

Intercept terms are implicitly inserted. The following two are equivalent.

gsem (x1 <- X) (x2 <- X) (x3 <- X) (x4 <- X)

gsem (x1 <- X _cons) (x2 <- X _cons) (x3 <- X _cons) (x4 <- X _cons)


Fixing Parameters

To fix a loading to e.g. 1, try:

... (x1 <- X@1) (x2 <- X) (x3 <- X)

To fix two more more loadings as equal, try:

... (x1 <- X@b) (x2 <- X@b) (x3 <- X)

In this example, b is implicitly declared as a coefficient that is equal across references. Note though that if b does not appear anywhere else, it is effectively unconstrained. Any valid label can be used in place of b.


Regressions

By default, the paths describe linear regressions. -gsem- adds support for other types of regression.

gsem (Y -> x1 x2 x3, oprobit)


Intercepts

Intercepts are freely estimated by default, but a common design choice is constraining them to 0. This is done like:

gsem (x1 <- X _cons@0) (x2 <- X _cons@0) (x3 <- X _cons@0) (x4 <- X _cons@0)


CategoryRicottone

Stata/Sem/PathSpecification (last edited 2025-10-24 21:03:10 by DominicRicottone)