David and Nick,
Thanks for your help!
While running the do file I encountered the following error message:
command -> myboot
error when command executed on original dataset under
version 8 control
r(198);
By now, it is probably quite obvious to you that I am just beginning to
learn to work with Stata, so it might be something very silly. Still, I hope
you will help me.
This is the do-file (as applied to a (simplified version of) my data set (my
model has of course more independent variables)):
capture program drop myboot
program myboot, rclass
sw logistic ras age bmi pp, forward pe (.1)
local vinf : list v in finvars
lroc, nograph
return scalar area=r(area)
for each v of varlist age bmi pp {return scalar `v'= ( `vinf' " , "
`v' " )>0}
end
clear
use "C:\My documents\prediction model.dta"
sw logistic ras age bmi pp, forward pe(.1)
lroc, nograph
bootstrap "myboot" r(area) r(rep78) r(age) r(bmi) r(pp), reps(100)
save (bootresults, replace)
clear
use bootresults
list
This is the output:
. capture program drop myboot
. program myboot, rclass
1. sw logistic ras age bmi pp, forward pe (.1)
2. local vinf : list v in finvars
3. lroc, nograph
4. return scalar area=r(area)
5. for each v of varlist age bmi pp {return scalar `v'= ( `vinf' " , " `v'
" )>0}
6. end
.
. clear
. use "C:\My documents\prediction model.dta"
. sw logistic ras age bmi pp, forward pe(.1)
begin with empty model
p = 0.0001 < 0.1000 adding age
p = 0.0056 < 0.1000 adding bmi
Logistic regression Number of obs =
328
LR chi2(2) =
26.55
Prob > chi2 =
0.0000
Log likelihood = -154.12872 Pseudo R2 =
0.0793
----------------------------------------------------------------------------
--
ras | Odds Ratio Std. Err. z P>|z| [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
age | 1.052812 .0135307 4.00 0.000 1.026624
1.079669
bmi | .909435 .0311763 -2.77 0.006 .8503382
.972639
----------------------------------------------------------------------------
--
. lroc, nograph
Logistic model for ras
number of observations = 328
area under ROC curve = 0.6926
. bootstrap "myboot" r(area) r(rep78) r(age) r(bmi) r(pp), reps(100)
command -> myboot
error when command executed on original dataset under version 8 control
r(198);
end of do-file
r(198);
Many thanks in advance,
Marieke
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/