# RE: st: graphs - help

 From siyama@who.int To statalist@hsphsun2.harvard.edu Subject RE: st: graphs - help Date Tue, 25 Feb 2003 13:55:12 +0100

```Hi Edlira,

What I want to do is that after getting the estimations say
for sex, then to graph sex 1 and 2 by _t.
But - after outfiling I can see that I get only the
estimation for I_sex1 as I_sex2 has been omitted. As 		a result
instead of getting two lines, I get only 1.
So in general the baseline is ommitted for each variable and
as a result it is also missing in the graph. 		Instad what I want
to show is the difference in hazard between males and females thus showing
the 		two curves....

I am attaching below the response you got from Robert Gutierrez
(rgutierrez@stata.com) - if you keep it simple by assuming a simple model
with no frailty, then the steps he suggested as:

xi: streg i.sex i.marstat i.occup, dist(gompertz) robust hr
foreach v of varlist _I* {
replace `v' = 0
}
predict h_standard, hazard

are giving you the baseline hazard "h_standard". Now this is the baseline
hazard for all your categorical variables baseline groups (for example, if
I_sex1=Males, Ioccupnew_2=1,..etc).  Hence, everytime you outfiling,
"h_standard" should be included with the relevant variable. For example,

stcurve, hazard at1(h_standard) at2(I_sex2=1)  outfile(myhazard1, replace)

stcurve, hazard at1(h_standard) at2(_Ioccupnew_1=1) at3(_Ioccupnew_3=1)
at4(_Ioccupnew_4=1) at5(_Ioccupnew_5=1) at6(_Ioccu pnew_6=1)
at7(_Ioccupnew_7=1) outfile(myhazard2, replace)

and so forth for the other covariates in your model.

I hope that helps.

All the best,

Amani

-----Original Message-----
From: Gjoncae@aol.com [mailto:Gjoncae@aol.com]
Sent: Monday, 24 February 2003 13:32
To: statalist@hsphsun2.harvard.edu
Cc: rgutierrez@stata.com
Subject: Re: st: graphs - help

Many thanks for your help. It works well now but I have another question.
You add the option alpha1 when predictiong the hazard after running the
model with heterogeneity- predict h_frailty, hazard alpha1. Does that mean
that you assume shared frailty?

In my data, I have no reason to believe that there is shared frailty. Should
I use alpha1, unconditional or no option at all?

Thank you
Edlira

**********************************************

> 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
rgutierrez@stata.com

*
*   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/
*
*   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/
```