Dear Statalist,
I have a weird combination of problems. I'm writing a small program for computing the earnings penalties associated with first child birth for women and men. The parameters of interest is constructed as nonlinear combinations of regression parameters, and I want my program to work with bootstrap to compute bootstrapped standard errors and to use the delta method (using nlcom). In addition, it would be nice to have the program fast and efficiently spit out the parameters without standard errors. The problem is the following
I have a weird combination of problems. I'm writing a small program for computing the earnings penalties associated with first child birth for women and men. The parameters of interest is constructed as nonlinear combinations of regression parameters, and I want my program to work with bootstrap to compute bootstrapped standard errors and to use the delta method (using nlcom). In addition, it would be nice to have the program fast and efficiently spit out the parameters without standard errors. The problem is the following
- It is not possible to store an estimate with estimates store unless the program returns e(cmd): "Last estimation result not found, nothing to store". Works fine with the user written eststo
- If returning e(cmd), I cannot bootstrap using the program. Bootstrap complains "varlist required". It has to do with the bootstrap display following the repetitions, and looks like a conflict between bootstrap setting e(cmd) and e(cmdline) and my program doing the same.
Code:
cap program drop testcmd { prog define testcmd, eclass version 15.0 syntax varname [, cmd] qui proportion `varlist' mat b=e(b) mat V=e(V) if "`cmd'"=="" ereturn post b V else ereturn post b ereturn local cmdline "testcmd `0'" if "`cmd'"!="" ereturn local cmd "testcmd" ereturn di end } sysuse auto, clear testcmd rep78 est sto nocmd ///Does not work because e(cmd) not set testcmd rep78, cmd est sto nocmd ///Works fine bootstrap, reps(2): testcmd rep78, cmd est sto bootcmd /// Does not work, some conflict with bootstrap setting e(cmd) bootstrap, reps(2): testcmd rep78 est sto bootnocmd /// Works fine