sgmediation安装包里的文件需要放在stata的ado/base文件夹下
Bootstrap检验命令:
bootstrap r(ind_eff) r(dir_eff), reps(1000): sgmediation y, mv(x) iv(Z) cv(x1 x2 x3)
//y为被解释变量,x为解释变量,x1 x2 x3为控制变量,Z为中介变量,计算间接效应ind_eff(_bs_1)、直接效应dir_eff(_bs_2)
estat bootstrap, percentile bc //计算95%的置信区间
sgmediation2安装包命令:
net install sgmediation2, from("https://tdmize.github.io/data/sgmediation2")
//下载sgmediation2安装包
Bootstrap检验命令与上相同,把sgmediation改成sgmediation2就行


雷达卡



京公网安备 11010802022788号







