Dear All,
I have cause of death data but there is known to be undereporting of cause of deaths from drugs. For a subsample I have data from the cornoners office which is more accurate. I am trying to estimate a predictice model and compare how the model performs to the accurate data from the coroners office. I have used basic individual chracteristics like age, gender and education as the predcitors. I want to bootstrap the 'error' in prediction and have written the following code:
capture program drop myboot
program define myboot, rclass
preserve
bsample
reg ICD_Opioids Sex White Black Hispanic Married hsorless age3160 ///
age030 age60plus edumiss Home Other HospInpat EDOutpat Month2 if (T509~=1)
predict numdeaths_ruhm if T509==1
gen numdeaths_diff = numdeaths_ruhm - numdeaths_tox // Main statistic of interest. Is it different from 0?
restore
end
bootstrap numdeaths_diff = r(numdeaths_diff) numdeaths_ruhm = r(numdeaths_ruhm) numdeaths_tox = r(numdeaths_tox), saving(bootstrap, replace) reps(500) seed(1234): myboottwo sources of the same data. The dummy variable T509 captures the sample (1- moreOne is more accurate than the other.
I get the error: 'r(numdeaths_diff)' evaluated to missing in full sample
But this is not the case when I tab numdeaths_diff. I know I am making some error in the return command but am not sure where and how to fix it.
Please help.
Sincerely,
Sumedha.
I have cause of death data but there is known to be undereporting of cause of deaths from drugs. For a subsample I have data from the cornoners office which is more accurate. I am trying to estimate a predictice model and compare how the model performs to the accurate data from the coroners office. I have used basic individual chracteristics like age, gender and education as the predcitors. I want to bootstrap the 'error' in prediction and have written the following code:
capture program drop myboot
program define myboot, rclass
preserve
bsample
reg ICD_Opioids Sex White Black Hispanic Married hsorless age3160 ///
age030 age60plus edumiss Home Other HospInpat EDOutpat Month2 if (T509~=1)
predict numdeaths_ruhm if T509==1
gen numdeaths_diff = numdeaths_ruhm - numdeaths_tox // Main statistic of interest. Is it different from 0?
restore
end
bootstrap numdeaths_diff = r(numdeaths_diff) numdeaths_ruhm = r(numdeaths_ruhm) numdeaths_tox = r(numdeaths_tox), saving(bootstrap, replace) reps(500) seed(1234): myboottwo sources of the same data. The dummy variable T509 captures the sample (1- moreOne is more accurate than the other.
I get the error: 'r(numdeaths_diff)' evaluated to missing in full sample
But this is not the case when I tab numdeaths_diff. I know I am making some error in the return command but am not sure where and how to fix it.
Please help.
Sincerely,
Sumedha.