I am trying to obtain coefficients, bootstrap standard errors and percentile CI for an indirect effect using gsem. I saw this code online
Code:
capture program drop boot1 program boot1, rclass gsem (Y<- X1 i.X2 X3 Z P[province] C[province>district_no]) /// (Z<-X1 i.X2 X3 P[province] C[province>district_no]), nocapslatent latent (P C) return scalar X1_indirect=(_b[Z:X1]*_b[Y:Z]) return scalar X21_indirect=(_b[Z:1.X2]*_b[Y:Z]) return scalar X22_indirect=(_b[Z:2.X2]*_b[Y:Z]) return scalar X3_indirect=(_b[Z:X3]*_b[Y:Z]) end bootstrap r(X1_indirect) r(X21_indirect) r(X22_indirect) r(X3_indirect), seed(12345) reps(200): boot1 estat boot, bc percentile
Code:
gsem (Y<- X1 i.X2 X3 Z P[province] C[province>district_no]) /// (Z<-X1 i.X2 X3 P[province] C[province>district_no]), nocapslatent latent (P C)
Thanks in advance!
0 Response to Help with boostrap code for indirect effects using gsem
Post a Comment