My objective is to run an IV regression using --ivreg2-- and obtain a nonlinear combinations of the coefficients obtained through the --nlcom-- command. My independent variable is discrete and ranges from 1-7. There are eight dependent variables, six of which are endogenous, some of which are discrete and some of which are continuous.
When I run a stand-alone regression and calculate the desired combinations, theoretically reasonable results are returned. When I write a small program and use --bootstrap--, however, the standard errors on the coefficients become enormous. Below I have inserted an example, with some output deleted for brevity, that illustrates the code i have and the results it returns.
Stand-alone regression:
Code:
ivreg2 y var7 var8 (var1-var6 = inst1-inst21), robust * Recover structural parameters forval i=1/8 nlcom _b[var`i']/(_b[var1] + _b[var2] + _b[var3] + _b[var4] + _b[var5] + _b[var6] + _b[var7]+ _b[var8]) tempname a matrix `a' = r(b) return scalar alpha`i'`x' = `a'[1,1] } ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _nl_1 | .1996965 .1414433 1.41 0.158 -.0775273 .4769204 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _nl_1 | .1853465 .1051298 1.76 0.078 -.0207041 .3913972 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _nl_1 | -.1270809 .2085744 -0.61 0.542 -.5358792 .2817175 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _nl_1 | -.0358595 .1373886 -0.26 0.794 -.3051362 .2334172 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _nl_1 | .1144584 .0712662 1.61 0.108 -.0252208 .2541376 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _nl_1 | -.1707009 .1426043 -1.20 0.231 -.4502003 .1087984 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _nl_1 | .8341398 .1402829 5.95 0.000 .5591903 1.109089 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _nl_1 | -.0786737 .015096 -5.21 0.000 -.1082612 -.0490861 ------------------------------------------------------------------------------
Code:
cap program drop myprog program define myprog, rclass args y ivreg2 `y' var7 var8 (var1-var6 = inst1-inst21), robust * Recover structural parameters forval i=1/8 nlcom _b[var`i']/(_b[var1] + _b[var2] + _b[var3] + _b[var4] + _b[var5] + _b[var6] + _b[var7]+ _b[var8]) tempname a matrix `a' = r(b) return scalar alpha`i' = `a'[1,1] } end bootstrap alpha1 = r(alpha1) alpha2 = r(alpha2) alpha3 = r(alpha3) alpha4 = r(alpha4) /// alpha5 = r(alpha5) alpha6 = r(alpha6) alpha7 = r(alpha7) alpha8 = r(alpha8), reps(100) seed(123) myprog yvar Bootstrap replications (50) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 .................................................. 50 Bootstrap results Number of obs = 8558 Replications = 50 command: myprog y alpha1: r(alpha1) alpha2: r(alpha2) alpha3: r(alpha3) alpha4: r(alpha4) alpha5: r(alpha5) alpha6: r(alpha6) alpha7: r(alpha7) alpha8: r(alpha8) (Replications based on 8558 clusters in mcsid) ------------------------------------------------------------------------------ | Observed Bootstrap Normal-based | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- alpha1 | .2096561 10.99415 0.02 0.985 -21.33849 21.7578 alpha2 | .1915124 8.941921 0.02 0.983 -17.33433 17.71736 alpha3 | -.0922069 3.705333 -0.02 0.980 -7.354527 7.170113 alpha4 | -.0344993 11.74894 -0.00 0.998 -23.06199 22.99299 alpha5| .1248302 9.492833 0.01 0.990 -18.48078 18.73044 alpha6 | -.1941109 1.939475 -0.10 0.920 -3.995411 3.607189 alpha7| .8777258 20.61115 0.04 0.966 -39.51938 41.27483 alpha8| -.0829073 .4029478 -0.21 0.837 -.8726704 .7068557 ------------------------------------------------------------------------------
Thanks in advance,
Mark
0 Response to Standard errors becoming enormous when using bootstrap
Post a Comment