Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bootstrap in a loop

    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
    }

  • #2
    As asked, your question is very unikely to receive any substantive response. Two of the reasons why are:

    1) You mention a problem with -bootstrap-, but a call to that command does not appear within the code you have posted. We cannot know how you were using any bootstrap command, making diagnosis very difficult.

    2) "Not successful" doesn't give us any information about the nature of the problem you are experiencing.

    Other information is likely to eventually be necessary, but you might start by re-posting a version of your question that addresses these issues. (I'm saying this not as someone who will necessarily know how to solve your problem, but rather as advice about how to pose your question so that someone with relevant expertise might be able to help.)

    You'd also likely benefit from re-reading the FAQ for new users of StataList, and following its suggestions.

    Comment

    Working...
    X