What I would like is for the columns of the regressions that do not converge to have a dot (".") for the stored estimates (e.g. e(b), e(se), e(N) and e(k_controls_sel), etc.), so that I can see precisely which columns didn't converge. I thought the solution would be to manually create and store these estimates if the regression spits out an error (-rc == 430). But how can I manually do this? Or is there a better way?
I've attached some dataex but I couldn't include enough variables into dataex so that you can reproduce the lack of convergence (so you'll have to take my word for it...). Here is my code, where the extra variables are stored in $econ, $demog and $politics:
Code:
estimates clear forvalues i = 2013(1)2013 { foreach var in GII { local controls_`var' $econ $demog $politics c.`var'#c.($econ $demog ) foreach method in ds po xpo { foreach select in plugin cv adaptive { `method'regress G_STEMfprop `var' if year==`i', /// controls(`controls_`var'') resample(1) xfolds(5) selection(`select') rseed(64) if _rc != 0 { local conv "NO" } else { local conv "YES" } estimates store GSTEM`i'`var'_`method'_`select' if "`select'" == "plugin" { estadd local Tuning "\textit{plug}", replace } else if "`select'" == "cv" { estadd local Tuning "\textit{cv}", replace } else if "`select'" == "adaptive" { estadd local Tuning "\textit{adap}", replace } else { estadd local Tuning "\textit{NULL}", replace } /// estadd local Tuning "\textit{`select'}", replace estadd local Estimator "\textit{`method'}", replace estadd local Convergence "`conv'", replace } } } esttab GSTEM`i'* using "../Tex/Lasso/ML`i'.tex", replace unstack /// scalars(Estimator Tuning "Convergence Convergence?" /// "k_controls_sel Selected controls") /// b(%9.2f) se(%9.2f) sfmt(%9.0f) /// rename(GII equality WBL equality) brackets /// mgroups(GII WBL, pattern(1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0) /// prefix(\multicolumn{@span}{c}{) suffix(}) /// span erepeat(\cmidrule(lr){@span})) /// nomtitles nogaps nodep nonotes }
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(GII G_STEMfprop HDI_L1 GNIpc_L1 GNIpcratio_L1 HDI_f_L1 HDI_m_L1 HDIratio_L1 unempratio_L1 unemp_L1 unempyouth_L1 unempyouthratio_L1) 1.350119 -.530056 1.6468107 1.495874 .5421427 1.447422 1.5387285 .58638203 -.27793115 -.4317768 -.4028556 -.3991656 1.484906 -.9263493 1.4719187 1.929531 -.28471923 1.217569 1.3541586 .4099647 -.3242405 -.4910843 -.5917258 -.31485155 1.583404 -1.2777967 1.5020726 1.708658 .27621728 1.2976046 1.3958483 .5170524 -.3253803 -.04883888 .2596202 -.3606904 .8420768 .15717806 .790443 .067976505 .50633484 .671056 .5332401 .7813587 -.441689 .7322357 .9411384 -.4013202 1.350119 -.38309535 1.4598573 1.5070184 .5229612 1.308491 1.2970958 .7415117 -.3841619 -.09013935 -.1771267 -.4866935 .3651392 -1.6460524 .9472426 .25448307 -.3222311 .7663235 .8046443 .4235463 .0035964234 -.19471213 .016401809 .01232764 1.2723576 -.012733627 1.1764117 .9767638 .565453 1.004694 1.0235436 .5649824 -.3822291 .6537647 .807025 -.346941 1.251621 -.5880356 1.266873 .7851835 .09969018 1.1027188 1.0995001 .649528 -.05063437 -.14201269 .2373906 -.3274642 1.728559 .0021184075 1.6106262 1.8693686 .8610587 1.4341735 1.4869235 .6570624 -.2997848 -.05148208 -.20466866 -.3681746 1.1272026 -.372593 1.212596 .5961219 .180759 1.1527903 .9112204 1.1860987 -.4190056 .3606966 .3483753 -.4664214 1.6196924 -1.0878006 1.5503187 1.5401485 .9652123 1.405004 1.3044976 .9574409 -.4065473 -.02455416 .1844317 -.373998 1.5056424 -.3683792 1.3332113 1.4212747 .7770203 1.1954275 1.1437607 .785311 -.3092286 .25810617 .56740266 -.32323715 1.282726 .205845 1.212596 .6463212 .3451319 1.0093964 1.08979 .4383182 -.08716769 2.742577 3.136969 .01147425 .70729 -1.1298491 1.0075501 .3726539 .37262875 .8794734 .7818708 .7696331 -.3482224 .5229249 .9457151 -.3517827 -1.0034646 1.7755877 -.4036475 -.6278328 -1.8501546 -.8923425 -.4300005 -1.6966014 -.3109502 -.3610704 .391527 -.29748425 1.246437 -.9759285 1.4719187 1.3754157 .52041066 1.2865056 1.336179 .6097085 -.49764425 1.257743 1.1656414 -.6408159 1.500458 .3792053 1.3151193 1.3053873 .07811394 1.1298261 1.1770223 .5552128 -.1593708 .46543455 1.536108 -.1777862 .8317088 -1.3447845 1.0135812 .3731301 .6929133 .9840326 .6790185 1.283678 -.3986953 1.1910012 .9722763 -.23162834 1.2308847 -1.2608538 1.067858 .5192288 .9940391 1.0587906 .7394048 1.339018 -.46960175 .9131317 .82288 -.5141428 1.500458 -.05199154 1.4236726 2.98555 .14874643 1.2074043 1.2558496 .58251035 -.09075636 -.4456538 .1587696 -.29061052 .9198384 -.5452544 1.1824424 .7638975 -.6647866 .9156063 1.0937899 .19742955 -.10211507 -.27120057 -.2261627 -.1981203 .09038173 .05829702 .5733356 .08742659 -.395222 .372394 .3658165 .3413597 -.3055966 -.4874498 -.59115374 -.13233459 1.7130064 -1.1208919 1.592534 1.895689 .5839986 1.3767815 1.5103974 .4781129 -.2065549 -.3331513 -.4007307 -.2989657 1.1531231 -.3323922 1.4900112 1.0228437 .1472184 1.262346 1.408353 .4094013 -.2100319 -.14977716 .1092432 -.2372051 1.6456133 -1.148445 1.670934 2.3469555 1.2693384 1.526501 1.5009443 .8435919 -.48491335 -.778866 -.6675681 -.57370985 1.1738596 -.25393164 1.0738887 .42798525 .4723604 .9894972 .8075164 .9993626 -.1930988 .3717652 .801386 -.05319968 1.3708556 .37513 1.0377042 .672494 .7827792 .9178674 .8338687 .7538313 -.3058719 1.2702982 1.7467995 -.2220382 .3081141 .4024772 .8386889 .2253189 .5650941 .7131135 .6250208 .6828517 -.4245126 -.17240983 .4712921 -.25075805 1.0027843 -.4932146 1.0799193 .5307728 .04798828 .9407058 .8746041 .7229994 -.25138947 1.0119225 1.4265944 -.3537548 1.593772 -.776904 1.3271806 .8162903 1.279053 1.2322757 1.1026405 .9637933 -.22210127 .1655932 .3313762 -.26530102 1.4641695 -.4833039 1.3090882 .9878326 .309402 1.1345655 1.143564 .6360434 -.29045957 2.800068 2.9663236 -.3339077 1.723375 -.7295067 1.5081033 1.7459277 1.0950915 1.3831347 1.3109626 .8917144 -.3461137 .02285873 .5611097 -.3952659 1.6974543 -.7482518 1.6890262 2.6791315 .7458982 1.455103 1.6032313 .4798764 -.22941226 -.55386096 -.6774571 -.3560961 1.1012821 .2719156 1.4477956 1.3422573 -.20272757 1.225045 1.3431492 .4495035 -.381348 .007825427 .3648024 -.5144617 .6969219 -.5151795 1.544288 2.0933924 .46460176 1.422216 1.3923602 .8180048 -.331484 .03822257 -.016370486 -.453534 end
0 Response to Manually creating/editing/storing estimates for esttab
Post a Comment