Hi all,
I am trying to estimate standard error for the product of coefficients using a program below (labelled in code below as: indirect)
I can bootstrap all the estimates separately however when I try to estimate the standard error for the product of coefficients from two separate regressions it won't work. Although the boot strap program will return an estimate without any errors, it won't return a standard error.
I have also tried:
- nlcom
- generating temp var instead of scalars and then using this to calculate the indirect effect (returns an error when I bootstrap)
- the 'ml_mediation' program which details bootstrapping which I followed does not seem to be available anymore therefore I wrote the below program instead
Code:
Thank you in advance.
I am trying to estimate standard error for the product of coefficients using a program below (labelled in code below as: indirect)
I can bootstrap all the estimates separately however when I try to estimate the standard error for the product of coefficients from two separate regressions it won't work. Although the boot strap program will return an estimate without any errors, it won't return a standard error.
I have also tried:
- nlcom
- generating temp var instead of scalars and then using this to calculate the indirect effect (returns an error when I bootstrap)
- the 'ml_mediation' program which details bootstrapping which I followed does not seem to be available anymore therefore I wrote the below program instead
Code:
Code:
program boot1, rclass syntax [if] [in] xtmixed y z x c || newid:, reml // estimates mediator and treatment effects on Y return scalar direct = _b[x] //scalar for direct effect return scalar mediation_2 = _b[z] //scalar for indirect pathway 2 xtmixed z x c || newid:, reml // estimated indirect effect on mediator return scalar mediation_1 = _b[x] //scalar for indirect pathway 1 return scalar indirect = mediation_2 * mediation_1 // product of coefficients calculating the indirect pathway return list end set seed 1 bootstrap r(direct) r(mediation_2) r(mediation_1) r(indirect), cluster(id) idcluster(newid) rep(10): boot1
Thank you in advance.
Comment