Announcement

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

  • insufficient observations in bootstrap user written program

    Hi StataList
    I use Stata 14.1 on OSX.
    I'm running a cost-effectiveness analysis and in order to get factors associated with costs, I run a twopart model using the twopm Stata command. It perfectly works.

    The problem is I need to use both multiple imputations and bootstrapping (to get correct evaluations of CI).
    That's why I've written the code below

    Code:
    / evaluation first part to get OR & CI in appropriate format
    
    ***************program two-pm******************************
    logistic charge $var_indep
    estout, c(b ci) drop(_cons) label eform
    matrix matrix_logistic = r(coefs)
    
    capture program drop boot_tpm_cond
    capture program define boot_tpm_cond, eclass
    // use second part to get conditional costs
    glm    totalcharge_ccr    $var_indep if totalcharge_ccr>0, ///
            link(log) family(poisson)
            
    margins , dydx(*) post
    end
    
    capture program drop boot_tpm
    capture program define boot_tpm, eclass
    // use stata twopm command to get unconditional costs
    twopm    totalcharge_ccr    $var_indep, ///
            firstpart(logit)    ///
            secondpart(glm, link(log) family(poisson))
    margins, dydx(*) nose post
    end
    ***************program two-pm******************************
    
    
    
    
    ***************program bootstrap******************************
    capture program drop bootstrapperso
    program define bootstrapperso, eclass
    // premier bootstrap : condtional margins
    bootstrap _b, reps($rep) seed(2) bca ties nodrop: boot_tpm_cond
    local n_reps_cond = e(N_reps)
    matrix b_cond = e(b)
    matrix ci_cond = e(ci_bca)
    
    // deuxieme bootstrap : unconditional margins
    bootstrap _b, reps($rep) seed(2) bca ties nodrop: boot_tpm
    local n_reps_uncond = e(N_reps)
    matrix b_uncond = e(b)
    matrix ci_uncond = e(ci_bca)
    end
    ***************program bootstrap******************************
    
    
    
    ***************mi estimate sur l'ensemble******************************
    mi estimate,noisily cmdok: bootstrapperso
    ***************mi estimate sur l'ensemble******************************
    But when I run the program bootstrapperso, the following message appears:

    Code:
    . bootstrapperso
    (running boot_tpm_cond on estimation sample)
    
    Jackknife replications (2085)
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn    50
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   100
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   150
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   200
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   250
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   300
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   350
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   400
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   450
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   500
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   550
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   600
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   650
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   700
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   750
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   800
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   850
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   900
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn   950
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1000
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1050
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1100
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1150
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1200
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1250
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1300
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1350
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1400
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1450
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1500
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1550
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1600
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1650
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1700
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1750
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1800
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1850
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1900
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  1950
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  2000
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn  2050
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
    insufficient observations to compute jackknife standard
    errors
    no results will be saved
    r(2000);
    I've read several posts treating such a similar error message (like this one http://www.statalist.org/forums/search?r=42907686&p=12) but adding the no drop option did not change anything. Of course, I've not been able to run the mi estimate command.

    Thank you for you help


  • #2
    You added the option bca, so it will also Jackknife your model. In order to do so, your program needs to allow the if condition. You can do so with syntax and marksample.

    Having said that, it would be useless. The reason is that afterwards you intend to use mi on it, and mi will only look at the point-estimates and their standard error, and these are unaffected by the bca option.

    You seem to have problems with the normal approximation for the sampling distribution of your estimates. If those deviations are severe enough for you to choose bootstrap, then you probably cannot use mi. So you probably have to make a choice for one or the other.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Thank you very much Marteen for your reply.
      You are totally right, the cost variable has a very right-skewed distribution.
      The reason why I tried to use the bca option was with the bc option, my code worked well but some confidence intervals were missing. Could it be because I ran my model with too few replications (to check if it ran)?

      Comment


      • #4
        To be accurate, there was no bc option, but I retrieved CI bc estimation.

        Comment

        Working...
        X