I am trying to bootstrap within a loop. I tried but not sucessful. Would be glad to receive some help.
forvalues i = 1/2 { /* run twice, the 2nd time using the first time's result as init. So that the result is the same as the bootstrap's. */
if getout == 1 {
exit
}
if `i' == 2 {
mat myini1 = b0_gmm1
}
gmm sftreat_GMM4 if Dvar == 1, nequations(32) parameters($xvar b0 $xvarB b0B $zvar g0 $zvarB g0B) ///
mylhs(lQtyhar) myxvar($xvar) myzvar($zvar) mywght(W11) mywghtB(W10) ///
myp(m_d1) mypB(m_d0) ///
winitial(identity) ///
from(myini1) ///
onestep ///
conv_vtol(1e-5) conv_nrtol(1e-3) technique(dfp) iterate(20)
**** further checking ***********
local missingv = 0 /* flag */
if _rc == 0 {
mat checkv = e(V) /* V-COV matrix */
local vsize = colsof(checkv)
forvalues i = 1/`vsize' {
local checkstd = checkv[`i', `i']
if `checkstd' == 0 | `checkstd' > 2e+7 {
local missingv = 1
}
}
}
************************
if _rc == 0 & `missingv' == 0 {
mat b0_gmm1 = e(b)
}
else {
scalar getout = 1
exit
}
if getout ==1 {
exit
}
}
if getout ==1 {
exit
}
forvalues i = 1/2 { /* run twice, the 2nd time using the first time's result as init. So that the result is the same as the bootstrap's. */
if getout == 1 {
exit
}
if `i' == 2 {
mat myini1 = b0_gmm1
}
gmm sftreat_GMM4 if Dvar == 1, nequations(32) parameters($xvar b0 $xvarB b0B $zvar g0 $zvarB g0B) ///
mylhs(lQtyhar) myxvar($xvar) myzvar($zvar) mywght(W11) mywghtB(W10) ///
myp(m_d1) mypB(m_d0) ///
winitial(identity) ///
from(myini1) ///
onestep ///
conv_vtol(1e-5) conv_nrtol(1e-3) technique(dfp) iterate(20)
**** further checking ***********
local missingv = 0 /* flag */
if _rc == 0 {
mat checkv = e(V) /* V-COV matrix */
local vsize = colsof(checkv)
forvalues i = 1/`vsize' {
local checkstd = checkv[`i', `i']
if `checkstd' == 0 | `checkstd' > 2e+7 {
local missingv = 1
}
}
}
************************
if _rc == 0 & `missingv' == 0 {
mat b0_gmm1 = e(b)
}
else {
scalar getout = 1
exit
}
if getout ==1 {
exit
}
}
if getout ==1 {
exit
}
Comment