Hello everyone!
I am trying to randomly draw samples T times with replacements to compute first-stage regressions' residuals. Then, I want to put fitted residuals to the second-stage regression to compute and store the beta coefficients. However, Stata shows the following messages which got me very confused, does anyone possibly know what is the issue? How to address those problems? Many thanks to you in advance!
Please see my code here:
Here is my data:
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
Listed 100 out of 49576 observations
Use the count() option to list more
I am trying to randomly draw samples T times with replacements to compute first-stage regressions' residuals. Then, I want to put fitted residuals to the second-stage regression to compute and store the beta coefficients. However, Stata shows the following messages which got me very confused, does anyone possibly know what is the issue? How to address those problems? Many thanks to you in advance!
Code:
. bootstrap b3=r(b_a) , reps(100) saving(contro_function, replace): boot14 (running boot14 on estimation sample) warning: boot14 does not set e(sample), so no observations will be excluded from the resampling because of missing values or other reasons. To exclude observations, press Break, save the data, drop any observations that are to be excluded, and rerun bootstrap. Bootstrap replications (100) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 xxxxxxx.xxxx..xx.xx.xxxxxxxxxxxxxxxxxxxx.xxxxxxxxx 50 xxxxx.xxxxxx.xxxx..xxxx..xxxx.xxxxxx.xx..xx.x.xxxx 100 Bootstrap results Number of obs = 49,576 Replications = 18 Command: boot14 b3: r(b_a) ------------------------------------------------------------------------------ | Observed Bootstrap Normal-based | coefficient std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- b3 | .613626 .2946258 2.08 0.037 .0361699 1.191082 ------------------------------------------------------------------------------ Note: One or more parameters could not be estimated in 82 bootstrap replicates; standard-error estimates include only complete replications. . end of do-file
Code:
capture program drop boot14 program boot14, rclass preserve bsample reg inv iv , vce(robust) predict resid, res reg ret invdc inv resid , vce(robust) return scalar b_a = _b[invdc] drop resid restore end * Collect the estimates of the bootstrapped sample bootstrap b3=r(b_a) , reps(100) saving(contro_function, replace): boot14
Here is my data:
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double ret float(inv invdc) double iv -.04961428089401898 .27005982 -.018155484 . -.22056605676334473 .38821965 -.004845029 -.03668068251172739 -.30930798818028893 .3278764 -.004243195 -.062490352716676655 -.28010347604012575 .21072122 .006785414 .048175694128725126 -.3166547796891288 .23121995 .012376579 -.06262456728486036 -.6227323268790463 .14336672 -.002691276 -.1060585855727873 .522053674851257 .10208935 .0078618 -.03944522899664229 .5116373331489146 .15423504 .003860576 -.034474051513488695 .24594192118342972 .2832655 .03689085 -.013788257404424561 .19048281210629514 .24740204 -.01240136 .012619003363873898 -.3468500246974311 .1976828 .004125444 .04293385635537561 .08468538976898499 .13579234 .000017993518 -.0828613503690576 .012087733895459918 .1040323 -.006565377 .0028409437131981757 .0981714967389784 .12642549 -.003823944 .015950791820917704 -.421654401904177 .3526083 .002882691 -.015327869129746603 .25985248333123856 .27447456 .00368424 -.015176815422213016 .033568135800547294 .1575507 .002577797 -.0009150401014267118 .22760554480840534 .2600849 -.009664644 -.019712306061733 -.15425974286047728 .14738914 -.0030249904 -.03286786335391096 .2377130868318209 .1590743 -.00399914 .01874695899823564 .11584696099381486 .18521783 .004759869 .05879432299601225 -.13685296251250045 .5926506 -.01016756 . -.6469602332942868 .521215 .02071587 -.04239908948921009 .7713922366950607 .4290733 -.0001871994 -.04582238089298024 .6919125183374604 .59097844 .0841539 .02545973878039111 -.4544929246339886 .3740958 -.022775736 -.07649530688318214 -.6686547306332866 .23428753 -.009759367 -.164069739964625 .3021467039340917 .23158322 .08334582 -.03148858995891537 -.16159175354202404 .29197618 -.036953863 -.01482461778616159 -.007572702591820635 .3061119 -.01209638 .022289722670260897 -.3244985355848873 .3610792 .014103292 .049792709051736245 .08220222739426752 .3883219 .004898537 .017333730036811587 -.39037259330319507 .3394877 .007707188 -.05736642171015976 .05121732268705548 .2354993 -.035101276 .0037941752971911453 .34518984038627387 .3103733 .05790906 -.006278144067133931 -.7661222219639945 .7806057 -.0539926 .0726931281387806 .08564601776069591 .5188672 -.008382258 . .641135595802165 .4194906 .002710148 -.018430050109120192 -.11524121198065007 .3842449 .001183503 -.00800828787499125 .2314459101234858 .425507 .02636023 .00603116119301379 -.5396029819875243 .56169444 -.021314517 -.05398362768607879 -.3221066632221051 .4327949 .0033623064 -.13595821782196496 .15943604077057638 .4020001 .022754414 -.0346096129325462 -.43039446857547303 .3646158 .015180438 -.024448523750071508 .588178083697054 .3596764 .1971532 -.000025684929303087384 -.41501228676146773 .36189035 -.15974565 .03088731848647386 -.10130267800731751 .4252713 .05832109 .006368301309506889 -.009372464036497274 .25317362 -.005291224 -.03586177889115384 -.2391491532653609 .4109194 -.017830778 . -.19032729018606365 .3870602 .002762641 -.012229419701747216 -.9968585119421673 .3840435 .11000445 -.056589479188837256 .4151014677942739 .2984484 -.15683134 .014759344651901233 .07944815834990004 .3983275 .030118853 . -.32546071485677774 .4053787 -.013958106 -.023050586829970906 .21979491074511048 .3434953 -.011251494 -.034518272591513875 .16133994638474003 .26964176 .009738836 .05695797016243078 -.5480336987937037 .3268756 .039581 -.0627174328094884 -.22650788661236143 .2218887 -.02100811 -.14721327322470457 .5687108942362402 .2141341 .070194356 -.049831356846795016 .03851558811911193 .2302409 -.0007711676 .0017666128610640223 -.1479819461550158 .23356475 -.01561847 .033795040186777 .4928531179974518 .1915909 .0004004981 . .06580597372119801 .08696392 -.001646371 -.03529262656229548 -.7574855989429666 .11176958 .012034748 -.0147836056688296 -.39692046707654216 .05868051 .0003068448 -.036773062873786934 -.7143130043022057 .07815827 .0014305165 -.0023692470276728272 .8908390752705106 .10033725 -.0012404296 -.05269610253162682 .6033056771719045 .3558868 -.0004040371 .007281687459908426 .4399986335696273 .26634738 .00057600567 .016590163596750546 .260759780474889 .20646103 .00037838775 -.007096713929462969 -.38920400195739824 .3211156 .0011154452 -.052106093063706616 .36296535601424806 .12959677 .0006802364 -.026209391047900904 .1902169359068886 .1601058 .012304164 -.029344624476895356 .0834252956086814 .16636625 .012786265 -.027927392136512533 .6363697742970658 .1771918 .02190958 -.02368090489314151 .19480024532143925 .7806057 -.007592358 -.002801563784790536 -.3962695527952501 .18499543 .009195429 -.02769168761706506 .46892422432478775 .1321885 .0040908814 .03159921399477147 -.7268929972589191 .13125807 -.004834705 .04792182846358628 -.20992364682059328 .3709257 -.000016004997 . .8724147579565111 .4259396 -.06036609 -.031577382391638875 1.2859963622247264 .7065114 .12332215 .015757691085929292 -.12233336623991409 .4269331 .005192142 -.07625623681712136 -.17456024476700394 .2072808 -.015039855 -.13811262130202082 .10461240017864437 .25829524 .007265656 -.03286392702850016 .511379267464722 .1804669 .017180432 -.011521413416549975 -.5451487831511342 .166608 -.014764564 .010678725843899882 .24077539025922312 .3630988 .01435876 .03392699563604158 .05352109865887811 .3404038 -.00605064 -.022077275064345616 3.002721087811331 .19113117 -.0002786142 .009721547126294658 -.17310391599029817 .2520371 .011657045 .038817633376715496 -.08716938987597489 .2996293 .009558694 -.05291935144036653 -.36123546122881467 .0873573 -.00260941 -.08779181192048348 .19541293665373471 .1125001 .0034848615 -.02577926188819724 -.4254276831795182 .15688044 -.00302927 -.011051689069427087 .30158598056836583 .2493175 .013656947 .010457821211457484 -.26806393900943715 .11325236 .005364159 .029160899795695316 -.061702723553927585 .19365713 -.014212267 .0022330899325121814 -.04570330720729854 .331943 -.017650666 -.05529634692400231 -.1561729747619951 .11007726 .0087314285 .04530653828987852 end
Listed 100 out of 49576 observations
Use the count() option to list more
Comment