Announcement

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

  • bootstrap for internal validation: how can we get the bootstrap estimated AUC with a multiply imputed data?

    Dear Statalist,
    I wish to get the apparent AUC of bootstrap internal validation in a multiple imputed sample. Many thanks for this valuable forum, I have learned how to get the coef. of each predictor in the prediction model with helps from https://stats.idre.ucla.edu/stata/faq/how-can-i-perform-bootstrap-estimation-with-multiply-imputed-data/ .

    And I found the code for the imputed AUC as follow:
    cap program drop eroctab
    program eroctab, eclass properties(mi)
    1. version 15.1
    2. args refvar classvar
    3. roctab `refvar' `classvar'
    4. tempname b V
    5. mat `b' = r(area)
    6. mat `V' = r(se)^2
    7. local N = r(N)
    8. mat colnames `b' = AUC
    9. mat colnames `V' = AUC
    10. mat rownames `V' = AUC
    11. ereturn post `b' `V', obs(`N')
    12. ereturn local cmd "eroctab"
    13. ereturn local title "ROC area"
    end

    But I can not find the correct code for the bootstrap estimated AUC with my multiply imputed data. I tried this code, but failed to get anything.
    mi set flong
    mi register imputed jobm snec bmi mrcyn lungsymp edu3
    set seed 20039
    mi stset, clear
    mi impute chained (regress) bmi (mlogit)jobm (ologit)snec (ologit) edu3 (logit)mrcyn (logit)lungsymp = AO agec sex diaasthma, add(10)
    mi describe,detail
    mi estimate,saving(preao): logistic AO agec i.sex i.jobm i.snec bmi i.mrcyn i.lungsymp i.diaasthma
    mi predict xb_mi using preao
    mi passive: generate phat = invlogit(xb_mi)
    mi estimate: eroctab AO phat
    matrix list e(b_mi)
    drop xb_mi phat

    cap program drop myboot
    program define myboot, rclass
    1. mi estimate: eroctab AO phat
    2. return scalar b_auc = e(b_mi)
    end

    . set seed 23543
    . bootstrap b_AUC=r(b_auc) , reps(100) : myboot

    But the response is "1. is not a valid command name
    an error occurred when bootstrap executed myboot"

    The eroctab command had been defined at the upper code.

    I did not know how to get the bootstrap estimated AUC with a multiply imputed data, would anyone help me with this problem?
    And I did not know how to draw a calibration plot of internal bootstrap validation in our multiply imputed data.
    Any helps would be appreciated.
    Jing Pan




  • #2
    The immediate error is having "1." and "2." in the text of the program definition

    Comment

    Working...
    X