Announcement

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

  • Bootstrapping code for Wald tests on interaction variables

    I have run the command below in Stata 14

    set more off
    set seed 12345
    cap program drop iv_wald
    program define iv_wald, rclass
    args varlist
    reg ANC rain ib0.educ married miscarriage caesar ib1.SES age age2 ib1.birthorder wanted permission ib1.religion urban ib1.ethnic
    cap drop uhat
    predict uhat, res
    return scalar b_iv = _b[rain]
    reg LBW c.prophylaxis##c.ANC4 c.prophylaxis##c.ANC1 `varlist' uhat SS1
    return scalar b1 = _b[c.prophylaxis##c.ANC4]
    return scalar b2 = _b[c.prophylaxis##c.ANC1]
    return scalar b_uhat = _b[uhat]
    return scalar b_SS1=_b[SS1]
    end
    local controls = "gestation NDVI sex ib0.educ married twin miscarriage caesar ib1.SES age age2 ib1.birthorder wanted permission ib1.religion urban ib1.ethnic smoking"
    bootstrap b_iv=r(b_iv) b1=r(b1) b2=r(b2) b_uhat = r(b_uhat) b_SS1=r(b_SS1), reps(1000): iv_wald `controls'

    I ended up getting the following error message;

    invalid matrix stripe;
    c.prophylaxis##c.ANC4
    an error occurred when bootstrap executed iv_wald
    r(198);


    What could be the problem? Anyone please?

  • #2
    Reposted in the General Forum and answered there.

    https://www.statalist.org/forums/for...tion-variables

    Comment

    Working...
    X