--- On Sat, 25/4/09, Mark Hebblewhite wrote:
> Thanks for your suggestion, it worked! But it produced, as
> expected with the predict command, a prediction of the
> mean survival rate and SE for each individual row/animal
> in my dataset.
>
> To obtain one estimate of survival for say, the entire
> dataset, would it then be appropriate to just use summary
> statistics to calculate group-level means and SE's?
Below is an example of how to compute the hazards, se, and
confidence intervals at t=15 for someone of average age,
but still differentiated by drug. If you want one number,
then also replace the variable drug with one representative
value e.g. the mode.
*------------- begin example -------------------
sysuse cancer, clear
stset studytime, failure(died)
xi: streg i.drug age, dist(weibull)
preserve
local t = 15
local p "exp([ln_p]_b[_cons])"
local h0 "`p' *`t' ^(`p' -1)"
sum age if e(sample), meanonly
replace age = r(mean)
bys drug : keep if _n == 1
predictnl hazard = `h0' * exp(xb()), ci(lb ub) se(se)
list drug hazard se lb ub, clean noobs
restore
*-------------- end example --------------------
-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/