= Stata SEM Groups = The '''`group`''' option is available only in `-gsem-`. <> ---- == Default and Implicit Behaviors == When groups are specified, paths are implicitly expanded such that the following two are equivalent. (Supposing that `gid` has 3 levels.) {{{ ... (x1 <- X) (x2 <- X), cov(e.x1*e.x2@c1) group(gid) }}} {{{ ... (1: y <- x1) (2: y <- x1) (3: y <- x1) /// (1: y <- x2) (2: y <- x2) (3: y <- x2) /// cov(1: e.x1*e.x2@c1) cov(2: e.x1*e.x2@c1) cov(3: e.x1*e.x2@c1) /// group(gid) }}} If a group's path is overriden like: {{{ ... (y <- x) (2: y <- x@c1) (3: y <- x@c1), /// group(gid) }}} Then the path interpretter will see: {{{ ... (1: y <- x) (2: y <- x) (3: y <- x) (2: y <- x@c1) (3: y <- x@c1), /// group(gid) }}} The path interpretter will combine the duplicative paths automatically into: {{{ ... (1: y <- x) (2: y <- x@c1) (3: y <- x@c1), /// group(gid) }}} ---- == Covariance Structures == To constrain variance to be equal across groups, try: {{{ ... (x1 <- X), /// var(e.x1@c1) /// group(gid) }}} This expands out to: {{{ ... (1: x1 <- X) (2: x1 <- X) (3: x1 <- X), /// var(1: e.x1@c1) var(2: e.x1@c1) var(3: e.x1@c1) /// group(gid) }}} Which precisely achieves that constraint. To instead constrain variance to be equal across some groups, try: {{{ ... (x1 <- X), /// var(e.x1@c2) var(2: e.x1@c1) var(3: e.x1@c1) /// group(gid) }}} (Supposing still that `gid` has 3 levels.) As `c2` only appears once in the expanded and combined interpretation, it is effectively unconstrained. ---- CategoryRicottone