|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: re-running a program and saving results
Dear Statalist members,
I've written the following simple program, which will estimate the
hazard ratio from a large simulated dataset containing 10,000
observations.
I'd like to ask for suggestions on how to modify my program so that it will:
1. Draw random samples from the dataset in memory, 1,000-observation intervals,
2. save the results (hazard ratio and confidence interval), and then
3. plot the results showing how the analysis performs on sample sizes
of 1,000, 2,000, 3,000 and so on up to 10,000.
This is the first program I've written, so not sure how to go about
this. I imagine it's something concise at the very last line?
capture program drop pcox
version 9.2
program define pcox, rclass
tempname a
* stset the data
stset risktime, failure(failed==1)
* cox
stcox a
indeplist, local
foreach var of varlist `X' {
return scalar `var' = exp(_b[`var'])
}
end
set seed 12358
bootstrap a=r(a), eform reps(10): pcox
*
* 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/