Table of direct, indirect, and total effects


asdocx offers a convenient way to export the table of total, direct, and indirect effects to MS Word, Excel, LaTeX, or HTML. asdocx compiles various statistics from the stored matrices and creates a complete table of coefficient, standard errors, s-statistics, and p-values. The syntax of the command is given below:

Syntax


* sem model should be run first then

asdocx estat teffects, [effects(te de ie) title(table_title) dec() 
       dect() decp() notes(table_notes) replace label tzok]

Option enclosed in [ ] are optional. Therefore, if they are not used, the total effects tables will be created.

Options


effects() –  is used to specify the type of effects that need to be report. We can specify all like this effects(te de ie) or one like this effects(te), where :

te : total effects
de: direct effects
ie: indirect effects.

title(table_title) – Table title reported at the top of the table.

notes(table_notes) : Table notes reported at the bottom of the table.

dec() – To set decimal points. Default is 3, that reports three decimal points.

dect() – To set the decimal points of the z-statistics. Default is 2.

decp() – To set the decimal points of the p-value values. Default is 4.

replace – To replace any existing table. Default is append.

label – Report variable labels instead of variable names.

tzok – Report equal number of decimal points, even if trailing values are zeros.

 

As noted above, estate teffects is valid only the sem model is already run. If you directly run the command, you shall get an error of

last estimates not found

 

Example 1: Base case


Let’s use an example of a sem model that is given in its help file.

* Load example dataset
webuse sem_sm1, clear

* Run the sem model
sem (r_occasp <- f_occasp r_intel r_ses f_ses) ///
    (f_occasp <- r_occasp f_intel f_ses r_ses), ///
     cov(e.r_occasp*e.f_occasp)

* Estimate and export the effects to Word file
* Without using the effects() option, the default of te is used
asdocx estat teffects
Table: Total effects
Variables Coef. Std. Err. z P>|z|
r_occasp 0.062 0.059 1.05 0.294
f_occasp 0.295 0.147 2.01 0.044
r_intel 0.303 0.051 5.94 0
r_ses 0.19 0.05 3.8 0
f_ses 0.153 0.051 3 0.003
f_intel 0.109 0.052 2.1 0.036
r_occasp 0.225 0.177 1.27 0.204
f_occasp 0.062 0.059 1.05 0.294
r_intel 0.064 0.049 1.31 0.19
r_ses 0.12 0.048 2.5 0.012
f_ses 0.201 0.049 4.1 0
f_intel 0.392 0.05 7.84 0
Notes:

 

Example 2: Report all effects


To report selected or all effects, use the effects() option.

* Load another dataset
use https://stats.idre.ucla.edu/stat/data/hsbdemo, clear

sem (read <- write math ses socst ) ///
    (science <- read math awards ) ///
    (write <- math read awards )

asdocx estat teffects, effects(te de ie) tzok replace
Indirect effects
Variables Coef. Std. Err. z P>|z|
read
read 0.008 0.006 1.33 0.1835
write 0.001 0.001 1.00 0.3173
math 0.020 0.017 1.18 0.2380
ses 0.006 0.007 0.86 0.3898
socst 0.002 0.002 1.00 0.3173
awards 0.480 0.377 1.27 0.2041
write
read 0.000 0.001 0.00 1.0000
write 0.008 0.006 1.33 0.1835
math 0.029 0.029 1.00 0.3173
ses 0.049 0.065 0.75 0.4533
socst 0.019 0.020 0.95 0.3421
awards 0.030 0.022 1.36 0.1738
science
read 0.003 0.002 1.50 0.1336
write 0.042 0.033 1.27 0.2041
math 0.156 0.039 4.00 0.0001
ses 0.264 0.248 1.06 0.2891
socst 0.101 0.030 3.37 0.0008
awards 0.161 0.131 1.23 0.2187
Notes:
Direct effects
Variables Coef. Std. Err. z P>|z|
read
read 0.000 0.000 . .
write 0.124 0.095 1.31 0.1902
math 0.444 0.074 6.00 0.0000
ses 0.780 0.717 1.09 0.2757
socst 0.299 0.064 4.67 0.0000
awards 0.000 0.000 . .
write
read 0.063 0.061 1.03 0.3030
write 0.000 0.000 . .
math 0.133 0.056 2.38 0.0173
ses 0.000 0.000 . .
socst 0.000 0.000 . .
awards 3.831 0.246 15.57 0.0000
science
read 0.335 0.068 4.93 0.0000
write 0.000 0.000 . .
math 0.356 0.077 4.62 0.0000
ses 0.000 0.000 . .
socst 0.000 0.000 . .
awards 0.579 0.359 1.61 0.1074
Notes:
Total effects
Variables Coef. Std. Err. z P>|z|
read
read 0.008 0.006 1.33 0.1835
write 0.125 0.096 1.30 0.1936
math 0.465 0.067 6.94 0.0000
ses 0.786 0.722 1.09 0.2757
socst 0.301 0.065 4.63 0.0000
awards 0.480 0.377 1.27 0.2041
write
read 0.063 0.061 1.03 0.3030
write 0.008 0.006 1.33 0.1835
math 0.162 0.045 3.60 0.0003
ses 0.049 0.065 0.75 0.4533
socst 0.019 0.020 0.95 0.3421
awards 3.861 0.244 15.82 0.0000
science
read 0.338 0.069 4.90 0.0000
write 0.042 0.033 1.27 0.2041
math 0.512 0.071 7.21 0.0000
ses 0.264 0.248 1.06 0.2891
socst 0.101 0.030 3.37 0.0008
awards 0.740 0.374 1.98 0.0477
Notes: