Mediation models in Stata are fit with the `sem`

command. `sem`

does not support `svyset`

data, so instead you use `gsem`

(e.g.Â `svy: gsem â€¦`

). However, `gsem`

does not support `estat teffects`

which calculates direct, indirect and total effects.

This document shows how to manually calculate these effects using `nlcom`

.

Note that this is a case where all variables are continuous and all models are linear - we are only using `gsem`

for itâ€™s support of `svy:`

, not itâ€™s support of GLMs. Indirect effects are a more complicated topic in those models which we do not address here. Additionally, weâ€™ll trust Stata to compute standard errors rather than getting into any sticky issues of bootstrapping.

First, letâ€™s estimate the direct, indirect and total effects without the use of the survey design to show equivalence.

```
. webuse gsem_multmed
(Fictional job-performance data)
```

The model weâ€™ll be fitting is