Differences between revisions 1 and 2
Revision 1 as of 2025-10-24 18:13:08
Size: 1721
Comment: Initial commit
Revision 2 as of 2025-10-24 18:15:19
Size: 1954
Comment: Clarifications
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

Covariance structures are a major component to fitting an SEM. There are several tricky differences between `-sem-` and `-gsem-` in this category.
Line 32: Line 34:

`-gsem-` disallows configuring the covariances of observed exogenous variables.

Stata SEM Covariance Structure

Covariance structures are a major component to fitting an SEM. There are several tricky differences between -sem- and -gsem- in this category.


Default and Implicit Behaviors

Error variables are assumed to be independent.


Fixing Parameters

To specify that two variables have non-zero covariance, use the cov option. This is mainly useful for error variables, since the default behavior is to assume independence.

... (x1 <- X) (x2 <- X) (x3 <- X), cov(e.x1*e.x2)

The option can be repeated to indicate that other variables also covary. For example, add cov(e.x2*e.x3) to the above.

On the other hand, to specify that two variables have zero covariance, try:

... cov(Y*X@0)

-gsem- disallows configuring the covariances of observed exogenous variables.


Structure

Sometimes, the simplest way to declare covariances is with a systemic statement. The alternate covstructure option takes two arguments: a variable list and a structure name.

Valid structure names are:

  • unstructured = all unrestructed
  • diagonal = variances unrestricted, zero covariance
  • exchangeable = equal (co)variance
  • identity = equal variance, zero covariance
  • zero = zero (co)variance

There are a few keywords that can be taken as a variable list on this option.

  • _Ex = all exogenous variables

    • disallowed in -gsem-

  • _OEx = all observed exogenous variables

    • disallowed in -gsem-

  • _LEx = all latent exogenous variables

  • e._En = all error variables

  • e._OEn = all error variables associated with observed exogenous variables

  • e._LEn = all error variables associated with latent exogenous variables

..., covstructure(_oexogenous, unstructured)

This option, like cov, can be repeated.


CategoryRicottone

Stata/Sem/CovarianceStructure (last edited 2025-10-24 20:45:31 by DominicRicottone)