Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: predict hazard


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: predict hazard
Date   Mon, 20 Oct 2008 10:17:42 +0100 (BST)

--- Chiara Mussida <[email protected]> wrote:
> i'm attempting to get the predicted hazard after a stpiece (piecewise
> constant hazard) estimation:
> firstly I estimate my model including the nopreserve option
> then I simply type: predict hazard. But the figures I get are quite
> strange (high absolute values) and represents the hazard computed
> allowing the median time assumption.
> Is there a more efficient way to get hazard after such a kind of
> estimation?

-stpiece- is just a wrapper for -streg-, so the defaults of -streg-
also apply to -stpiece-. To see the default -predict- option after 
-streg-, and thus -stpiece-, type -help streg postestimation-. It tells
you that if you just type -predict- you will get the median survival
time and not the hazard. If you want the hazard, you will have to
specify the -hazard- option in -predict-. If you want to predict that
hazard at the median survival time you can use -adjust-, like the
example below:

*-------------------- begin example --------------------------
sysuse cancer, clear
gen long id = _n
stset studytime, failure(died) id(id)
xi: stpiece i.drug age, tp(5 10 20 30) nopreserve
// predict hazards
predict haz, hazard
sum haz

stsum
// median time is 17, so tp3=1, rest=0
adjust tp1=0 tp2=0 tp3=1 tp4=0 tp5=0, by(age drug) exp replace
twoway line exp age if drug == 1 || ///
       line exp age if drug == 2 || ///
       line exp age if drug == 3,   ///
       legend(order(1 "placebo"     ///
                    2 "drug 2"      ///
                    3 "drug 3"))
*--------------------- end example ----------------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

Send instant messages to your online friends http://uk.messenger.yahoo.com 
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index