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)
- version 15.1
- args refvar classvar
- roctab `refvar' `classvar'
- tempname b V
- mat `b' = r(area)
- mat `V' = r(se)^2
- local N = r(N)
- mat colnames `b' = AUC
- mat colnames `V' = AUC
- mat rownames `V' = AUC
- ereturn post `b' `V', obs(`N')
- ereturn local cmd "eroctab"
- ereturn local title "ROC area"
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
0 Response to bootstrap for internal validation: how can we get the bootstrap estimated AUC with a multiply imputed data?
Post a Comment