Announcement

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

  • -bootstrap- errors out with "e(b) not found"

    I need help diagnosing and working around a problem that occurs within -bootstrap-. I have a workaround that I think is undesirable, described at the end, but I'd like a better understanding and some advice about the workaround.

    Here's the story:

    After a few replications of -bootstrap-, it stops with the error message "e(b) not found". I have confirmed that this message comes from -bootstrap-, rather than the program that -bootstrap- calls.

    I'm going to exercise judgement w.r.t to the forum dictim of "show everything," and give you what I think is the core of the code.

    Code:
    // Called program.  It's a wrapper around the user-written -khb-,
    // which does not play well with -bootstrap-.
    program khbboot , rclass  
    capture khb logit y x  || m, s d difficult iter(100)
    if (_rc > 0) {
      di "failed"
      return scalar ranok = 0
      return scalar b1 = .
      return scalar b2 = .
      etc.
    }
    else {
      di "ok"
      return scalar ranok = 1
      mat coeff = e(b)
      return scalar b1 = coeff[1,1]
      return scalar b2 = coeff[1,2]
      etc.
    }
    end
    //
    // Actual bootstrap call that gives the error
    set seed 1736
    bootstrap b1 = r(b1) b2 = r(b2) .....  /// ,
       noisily  saving("c:\temp\error.dta", replace) /// 
       size(150) reps(100): khbboot
    -bootstrap- stops at about the third replication with the message:
    Code:
    "e(b) not found"

    The error about e(b) occurs in an instance when the callee program displays "failed," so there is no reference to
    the callee's e(b) when the error occurs. On this basis, I presume that this error w.r.t. to e(b) comes from -bootstrap.
    In -bootstrap-, e(b), normally contains the results of the called program executed on the entire data set. I have verified that the callee program runs fine on the entire data set.

    Workarounds:
    I can remove the -capture- within the callee program, and run -bootstrap- under -capture-. By doing this, -bootstrap- will complete its replications, with missings for bad reps, but this seems unwise. (I am bootstrapping on 1000s of data sets, and -khb- sometimes chokes on a set of data, so I'm trying to trap those errors before -bootstrap- ever sees them.)

    So:
    Any ideas why -bootstrap- is complaining? And, can you suggest an approach that that would permit me to run -bootstrap- under -capture- control, but retain the -capture- within the called program?

    Regards, Mike

Working...
X