Announcement

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

  • Need Help with Bootstrapping Error - insufficient observations to compute bootstrap standard errors

    Hi all,

    I have been trying to bootstrap the difference between willingness to pay (WTP) for two groups. The bootstrap code runs the mixed logit for control and treatment groups using cmxtmixlogit function, extract the coefficients, calculate the willingness to pay (wtp), and bootstrap the difference. However, the code gives error -" insufficient observations to compute bootstrap standard errors". I fail to understand the reason.


    Code:
    capture program drop bootstr31
    program bootstr31, rclass
    cmxtmixlogit depvar_choice cost_ if group=="C" , random(mgmt_mharv_ mgmt_both_ cover_50_ cover_75_ effect_60_ effect_100_ impact_high_ impact_medium_)  basealternative(Choice B)
     scalar define b0 = _b[cost_]
     scalar define b1 = _b[mgmt_mharv_]
    scalar define wtp01 = _b[mgmt_mharv_]/(-_b[cost_])
     cmxtmixlogit depvar_choice cost_ if group=="T1" , random(mgmt_mharv_ mgmt_both_ cover_50_ cover_75_ effect_60_ effect_100_ impact_high_ impact_medium_) basealternative(Choice B)
     scalar define c0 = _b[cost_]
     scalar define c1 = _b[mgmt_mharv_]    
     scalar define wtp02 = _b[mgmt_mharv_]/(-_b[cost_])
    return scalar diff = wtp02-wtp01
     end
    bootstrap diff=r(diff), reps(100) nodrop: bootstr31
    Error - insufficient observations to compute bootstrap standard errors



    Code:
    My data: IID- Respondent id, set- #choice set, alt-alternative choices, Cost - cost_, Attribute levels - mgmt_mharv_ mgmt_both_ cover_50_ cover_75_ effect_60_ effect_100_ impact_high_ impact_medium_ (binary variables -1/0)
    * Example generated by -dataex-. For more info, type help dataex
    clear
     iid set alt depvar_choice cost_ mgmt_mharv_ mgmt_both_ cover_50_ cover_75_ effect_60_ effect_100_ impact_high_ impact_medium_
    1 1 "Choice A" 0  75 0 0 1 0 1 0 0 1
    1 2 "Choice A" 0  25 0 0 1 0 0 1 1 0
    1 3 "Choice A" 0  75 1 0 1 0 1 0 0 0
    1 4 "Choice A" 0 150 0 0 0 1 0 0 0 1
    1 5 "Choice A" 0  25 0 1 0 0 1 0 0 1
    1 6 "Choice A" 0  10 0 1 1 0 0 0 0 0
    1 1 "Choice B" 0 150 0 1 0 1 0 0 1 0
    1 2 "Choice B" 0  10 1 0 0 0 0 0 0 1
    1 3 "Choice B" 0  25 0 0 0 1 0 1 0 0
    1 4 "Choice B" 0  75 0 1 0 0 0 1 1 0
    1 5 "Choice B" 0 150 1 0 1 0 1 0 0 0
    1 6 "Choice B" 0  75 0 0 1 0 1 0 0 1
    1 1 "Choice C" 1   0 0 0 0 0 0 0 0 0
    1 2 "Choice C" 1   0 0 0 0 0 0 0 0 0
    1 3 "Choice C" 1   0 0 0 0 0 0 0 0 0
    1 4 "Choice C" 1   0 0 0 0 0 0 0 0 0
    1 5 "Choice C" 1   0 0 0 0 0 0 0 0 0
    1 6 "Choice C" 1   0 0 0 0 0 0 0 0 0
    end
    Last edited by abhishek rajan; 21 Feb 2023, 13:55.
Working...
X