tsset firm wave
xtabond2 y L LL K LK Ly dum2 dum3 wood1 textile1 metal1 anystat anyfor capcity, gmm (L LL K LK Ly) iv(dum2 dum3 wood1 textile1 metal1 anystat anyfor capcity ,eq(level)) small two robust
matrix cov1 = e(V)
matrix b1 =e(b)
md_ar1, nx(2) beta(e(b)) cov(e(V))
scalar betaL=theta[1,1]
******************** I have a balanced panel of firms for T=3
******************** Bootstrap program begins here:
capture program drop myboot2
program define myboot2, rclass
preserve
generate newfirm=firm
bsample , cluster(firm) idcluster(newfirm)
tsset newfirm wave
xtabond2 y L LL K LK Ly dum2 dum3 wood1 textile1 metal1 anystat anyfor capcity, gmm (L LL K LK Ly) iv(dum2 dum3 wood1 textile1 metal1 anystat anyfor capcity ,eq(level)) small two robust
tempname cov1
matrix cov1 = e(V)
tempname b1
matrix b1 =e(b)
md_ar1, nx(2) beta(b1) cov(cov1)
tempname betaL
return scalar betaL=theta[1,1]
tempname MRPLb
gen MRPLb=(1/L)
sum MRPLb
tempname MRm
return scalar MRm=r(mean)
restore
end
simulate betaL=theta[1,1] MRm=r(mean) , reps(3) seed(12345) :myboot2 trace
Here is the output in the data editor:
betaL MRm
.531211 .
.013747 .
.300624 .
Clearly, the code is bootstrapping betaL, but unable to calculate MRm.
Related Posts with Block bootstrapping panel: Unable to generate new variable using each bootstrap replication
xtabond2 with unbalanced panels and missing values in betweenHi everyone, I am conducting an empirical work where I am estimating the effect of financial develo…
Marginal Effects of Simultaneous Equation Systems or IV-RegressionsHi All, I would like to post-estimate marginal effects by group after executing reg3 or xtivreg. Fo…
Generating a new variableGood day! In this dataset I have, I have different indicators of innovation: (innov1, innov2, innov3…
three-year mean before an eventDear All, I found this question here (in Chinese). The data set is Code: * Example generated by -da…
Gini coefficient and Lorenz curveDear Statalist, I’m using Stata for the first time for a school assignment and since my knowledge o…
Subscribe to:
Post Comments (Atom)
0 Response to Block bootstrapping panel: Unable to generate new variable using each bootstrap replication
Post a Comment