I'm running Stata 15.1 on a Mac OS and working with experimental data. I've been conducting tests of mediation with the 'sureg' command (why sureg? because I have a series of pre-treatment covariates, some of which are categorical, and sureg allows the use of prefix 'i' operators) to determine whether or to what extent the effects of an experimental treatment (a dummy variable) on a continuous outcome variable are conveyed via a 3rd continuous post-treatment variable. I'd like to run a sensitivity analysis to test how robust the indirect effects are to violations of the 'no unmeasured confounding of the M-Y relationship' assumption. Unfortunately, I'm not sure if this is possible after a 'sureg'. Does anyone know if it is or how I can go about it? If not possible with sureg, what are my options as far as sensitivity analysis goes?
If it helps, here is the code/program I've been using to run the sureg models + calculate bootstrap standard errors:
Code:
capture program drop bootbm program bootbm, rclass syntax [if] [in] sureg (mediatior treatment i.ideo7 i.party7 male age i.educ i.region4) (outcome treatment mediator i.ideo7 i.party7 male age i.educ i.region4) `if' `in' return scalar indirecteffect = [mediator]_b[treatment]*[outcome]_b[mediator] return scalar totaleffect= [outcome]_b[treatment]+[mediator]_b[treatment]*[outcome]_b[mediator] return scalar directeffect=[outcome]_b[treatment] end bootstrap r(indirecteffect) r(totaleffect) r(directeffect), reps(10000): bootbm
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(outcome mediator) double treatment float age long ideo7 float party7 long(educ male region4) 1.0860398 .57275814 1 73 2 1 4 1 2 .4070499 .23108044 0 38 6 6 3 0 2 1.5952822 1.2561136 0 37 1 1 3 0 3 1.0860398 1.2561136 0 33 1 1 3 0 1 -1.1206771 -1.1356306 0 57 4 5 4 0 4 1.4255346 .914436 0 64 1 1 4 0 3 -1.2904246 .23108044 1 46 5 6 3 0 3 1.5952822 .06024148 0 78 2 1 4 1 3 1.4255346 .57275814 1 31 1 2 3 0 2 -1.460172 .4019194 1 31 3 2 1 0 4 -.6114347 -1.818986 0 40 2 2 3 1 1 -.27193987 .57275814 1 49 2 1 2 1 2 1.4255346 1.2561136 0 29 1 1 4 0 1 -1.460172 -.452275 0 25 1 1 3 1 4 .746545 .57275814 1 41 3 1 4 1 4 .2373026 .23108044 1 37 1 1 3 1 3 1.2557874 1.2561136 1 42 2 1 3 1 3 .4070499 .06024148 1 31 1 1 1 1 2 1.2557874 .914436 0 32 1 1 3 0 4 1.0860398 1.2561136 0 69 2 1 3 0 3 1.2557874 1.2561136 0 26 1 1 3 1 3 1.5952822 1.2561136 0 51 1 1 3 0 3 -1.1206771 -1.1356306 1 68 6 6 2 0 2 .5767974 .06024148 0 33 1 2 2 0 2 1.5952822 1.2561136 1 27 1 1 2 0 4 -.10219235 -.452275 1 38 2 1 2 0 3 .2373026 .57275814 0 50 2 1 4 0 3 .746545 1.2561136 1 70 3 3 1 0 3 .4070499 .7435971 0 35 2 3 3 1 1 -1.460172 -1.4773084 0 38 7 7 1 0 3 1.4255346 1.2561136 0 36 1 3 2 1 4 1.4255346 1.2561136 1 67 2 1 4 1 2 -.9509296 -1.1356306 0 47 6 6 3 1 4 1.0860398 1.2561136 1 45 2 1 2 0 2 -.27193987 -.11059724 1 53 6 7 2 0 4 1.2557874 1.2561136 0 37 2 2 1 1 3 .5767974 1.0852747 1 28 3 1 3 0 2 1.2557874 -.11059724 1 27 2 1 2 1 4 -1.2904246 -.11059724 0 64 1 1 3 1 1 -1.460172 -1.3064694 1 34 5 6 2 0 4 .06755506 .57275814 1 54 2 1 3 0 3 .06755506 .914436 0 44 3 3 2 1 4 -.4416873 .23108044 0 28 5 6 3 0 2 -.9509296 -.2814362 0 39 6 7 3 1 4 1.0860398 1.0852747 0 26 1 1 1 0 2 .5767974 .7435971 0 28 2 2 2 1 1 1.0860398 1.0852747 0 25 1 1 3 0 3 -.27193987 .23108044 0 42 1 1 2 1 3 1.0860398 1.2561136 0 33 2 2 4 0 2 .5767974 .23108044 1 56 3 3 4 1 1 -.4416873 -.9647917 0 22 3 1 3 0 1 .06755506 .7435971 0 49 2 3 2 1 4 1.2557874 1.0852747 1 23 1 1 2 0 3 .9162923 .914436 1 22 5 6 3 1 2 1.0860398 .7435971 1 36 1 1 3 1 2 -1.460172 -1.818986 1 30 6 7 3 0 1 -.9509296 -.7939528 0 23 2 2 4 1 1 .746545 1.2561136 1 60 3 1 1 0 2 1.4255346 1.0852747 0 41 2 2 2 1 3 -.6114347 -.7939528 1 36 3 1 2 0 3 1.4255346 .57275814 1 39 1 1 3 1 1 -.4416873 -.11059724 1 30 3 4 2 0 4 .5767974 .914436 0 26 3 2 4 1 1 -1.460172 -.7939528 1 60 3 4 3 1 3 1.2557874 .7435971 1 33 1 1 3 1 1 .5767974 1.2561136 0 24 1 3 1 1 2 .5767974 .06024148 1 57 2 1 4 0 2 .9162923 .914436 1 38 3 2 4 1 1 .9162923 .7435971 0 31 4 3 4 0 4 1.5952822 1.2561136 1 61 2 1 2 0 3 -1.460172 -1.818986 1 40 6 7 4 1 2 -1.460172 -.9647917 1 28 6 6 2 0 2 -.10219235 -1.3064694 1 39 2 2 4 0 3 .9162923 .4019194 1 69 1 1 2 0 3 -.4416873 .57275814 1 46 3 2 2 0 3 .9162923 1.2561136 0 33 1 1 3 0 1 .06755506 .23108044 0 35 4 2 4 1 3 -.7811822 .06024148 1 49 3 2 3 0 4 -.4416873 1.2561136 0 36 2 3 3 1 3 .06755506 .57275814 1 34 2 1 3 0 1 -.4416873 -.7939528 1 42 5 6 3 1 4 -.27193987 1.0852747 0 48 3 6 3 0 3 -.10219235 1.2561136 0 24 1 1 4 0 3 -.4416873 -.2814362 1 52 6 5 4 1 3 .746545 1.0852747 1 32 1 1 4 0 2 1.4255346 1.2561136 1 36 1 3 2 0 4 1.5952822 .7435971 0 33 2 2 2 1 4 -1.460172 -1.818986 0 40 7 7 3 0 2 -.27193987 .57275814 0 38 3 2 3 1 3 .5767974 1.2561136 1 24 3 2 2 0 3 .9162923 -.2814362 1 46 2 1 4 0 3 1.5952822 1.2561136 1 40 1 3 4 1 2 -.10219235 -.2814362 1 25 2 1 3 0 2 .2373026 -.452275 0 23 4 5 1 0 2 .5767974 .57275814 0 33 1 3 4 0 3 -.10219235 .23108044 0 29 1 1 3 1 3 1.0860398 .57275814 1 40 2 2 4 1 4 1.5952822 1.2561136 0 26 1 1 3 1 2 .06755506 .57275814 0 24 2 1 3 0 4 -.9509296 -.452275 0 35 3 2 2 0 3 end label values ideo7 ideo7 label def ideo7 1 "Conservative", modify label def ideo7 2 "Liberal", modify label def ideo7 3 "Moderate/Middle of the road", modify label def ideo7 4 "Slightly conservative", modify label def ideo7 5 "Slightly liberal", modify label def ideo7 6 "Very conservative", modify label def ideo7 7 "Very liberal", modify label values educ educ label def educ 1 "4 year/Bachelor’s degree", modify label def educ 2 "Doctoral or Professional degree", modify label def educ 3 "High school graduate", modify label def educ 4 "Less than high school graduate", modify
0 Response to Sensitivity analysis following mediation with sureg
Post a Comment