Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: graphs - help


From   [email protected] (Roberto G. Gutierrez, StataCorp.)
To   [email protected]
Subject   Re: st: graphs - help
Date   Fri, 21 Feb 2003 16:11:06 -0600

Eldira <[email protected]> asks:

> I am running two Gompertz models: one without considering heterogeneity -
> xi: streg i.sex i.marstat i.occup, dist(gompertz) robust hr

> and the other when I take heterogeneity into account as follows (e.g.):
> xi: streg i.sex i.marstat i.occup, dist(gompertz) frailty(gamma) robust hr

> After this, I would like to have a graph showing the 2 baseline hazard
> curves when considering the heterogeneity and when not considering it.

In frailty models, there is a distinction between the individual hazard (that
faced by individuals) and the population hazard (the average hazard over the
whole population).  A common phenomenon with such models is that the individual
hazard may be ever-increasing, yet the population hazard begins to fall past
a certain point.  This is known as the frailty effect -- after some time only
the most robust individuals remain in the population and thus their average
hazard is quite small.

That being said, in models without frailty the indiviual and population hazards
are the same, and thus it is fair to compare the estimated hazard from a 
standard model to either of the two hazards from the frailty model.  Suppose 
you are comparing individuals hazards, in which case

   . xi: streg i.sex i.marstat i.occup, dist(gompertz) robust hr
   . foreach v of varlist _I* {
     2. replace `v' = 0
     3. }
   . predict h_standard, hazard
   . xi: streg i.sex i.marstat i.occup, dist(gompertz) frailty(gamma) robust hr
   . foreach v of varlist _I* {
     2. replace `v' = 0
     3. }
   . predict h_frailty, hazard alpha1
   . graph twoway line h_standard h_frailty _t, sort

will do the trick.  Of course, I relied on the fact that all of Eldira's
regressors were indictators generated by -xi-, meaning I could replace their
values at will knowing that they would be restored the next time -xi- was
called.  In general, you would have to copy the values of your regressors to
variables with other names, set the original regressors to zero (baseline),
predict, then restore the original regressors' values before running the
second regression.

Finally, if you want to compare population hazards instead, simply omit the
-alpha1- option in the second call to -predict-.

--Bobby
[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/



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