Dear All,
I created the following program to bootstrap standard errors:
According to my understanding (which is clearly wrong, due to the results I get), Stata is supposed to estimate the model in red, then it should collapse the dataset according to the part of the code in green and run the second estimation and let me have my bootstrapped standard errors. After collapsing I should have about 950 observations. Instead, the run of the program produces the following table:
where the number of observations corresponds to the number of observations before collapsing (pink bold). I am bit lost about how I can achieve what I need. Any suggestion?
Thanks for any help you may provide.
Dario
I created the following program to bootstrap standard errors:
Code:
cap program drop myboot program define myboot, eclass preserve xtreg lnfdipccurrd lic Lgwtpol_corr legor_uk legor_fr legor_sc legor_ge Llnpoliticaldf Llntradedf Llntradedj Llnpop Lgrowthpwt Llneys i.time, r predict f, xb gen period = 5*floor(time/5) collapse pcgdp gcf f ndg pcgdpin, by(iso3 period) egen time = group(period) egen id = group(iso3) tsset id time gen lnpcgdp = ln(pcgdp) gen s = ln(gcf) gen lnndg = ln(ndg) gen lnf = ln(f) gen lnpcgdpin = ln(pcgdpin) xtreg lnpcgdp s lnndg lnf lnpcgdpin i.time, r matrix b=e(b) ereturn post b ereturn local cmd="bootstrap" restore end bootstrap _b, seed(12345) reps(500): myboot
Code:
Bootstrap results Number of obs = 4,659
Replications = 500
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
| coefficient std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
s | .0788844 .0161333 4.89 0.000 .0472637 .1105051
lnndg | -.0142946 .0036668 -3.90 0.000 -.0214814 -.0071078
lnf | .0128075 .0064819 1.98 0.048 .0001033 .0255117
lnpcgdpin | .9769231 .0031725 307.94 0.000 .9707051 .9831411
|
time |
1 | 0 (empty)
2 | .0056588 .0110584 0.51 0.609 -.0160153 .0273329
3 | -.0119457 .0110423 -1.08 0.279 -.0335882 .0096968
4 | .0034954 .0119264 0.29 0.769 -.0198799 .0268707
5 | -.0176491 .0126874 -1.39 0.164 -.0425159 .0072177
6 | -.0337107 .0128047 -2.63 0.008 -.0588076 -.0086139
|
_cons | -.0087348 .0603189 -0.14 0.885 -.1269576 .1094881
------------------------------------------------------------------------------
Thanks for any help you may provide.
Dario
Comment