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
Indirect effects with zero-inflated Poission regression / SEMDear all, I have a causal chain X -> M -> Y and am interested in the indirect effect of X on …
IV variable option in Stata program syntaxHello I am trying to write a program to run a regression based on some criteria and I want to add t…
Test to compare Positive and Negative Predictive Value?Hi all, I wonder if its possible use a test to compare Positive and Negative Predictive Value with …
Determining best fe-model with paneldata (u-test)Hello! I am new to stata and am investigating the relationship between paid leave (maternal and pare…
Create a boxplot with 2 x left axis to capture difference ranges #data visualisationHi folks - been mulling over this but can't quite figure out a good solution. Wondered if anyone had…
Subscribe to:
Post Comments (Atom)
0 Response to Block bootstrapping panel: Unable to generate new variable using each bootstrap replication
Post a Comment