纠结了半年的机制检验,到底是调节效应还是中介效应,这两者区别到底在哪里,目前有一点点眉目了,一步步更新和完善。先更新中介效应的代码,后面有时间接着完善两者区别和代码。
use "http://www.stata-press.com/data/r15/gsem_multmed", clear
///三步法
reg perform support //分析 x 和 y 之间的关系
reg satis support //分析 x 和 m 之间的关系
reg perform satis support
///两步法
reg satis support //分析 x 和 m 之间的关系
reg perform satis support
///sobel test
sgmediation perform, mv(satis) iv(support)
bootstrap r(ind_eff) r(dir_eff), reps(200) : ///
sgmediation perform, mv(satis) iv(support) //计算中介效应和间接效应
estat bootstrap, percentile bc //计算置信区间
///第一步更新