Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: stcurve: why two different graphs?


From   Oliver Eger <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: stcurve: why two different graphs?
Date   Thu, 20 Dec 2012 20:46:22 +0000 (GMT)

Dear Steve,

thanks again for the information!

Another thing:

In Stata testing of the PH assumption is quite easy, but what makes me a little irritated: all commands for checking the PH assumption are related to the Cox analysis. But: If the propotional hazard assumption is violated, the results from cox models as well as from parametric models like Weibull have to be handled with caution, isn´t it?

Why are there no commands like "estat phtest" after stcox, to check the PH assumption directly after a streg command?

Best
Oliver



________________________________
Von: Steve Samuels <[email protected]>
An: [email protected] 
Gesendet: 2:14 Sonntag, 9.Dezember 2012
Betreff: Re: st: stcurve: why two different graphs?


I'd just add that I don't even believe my original demonstration now.
Nonlinear predictions at the covariate mean can at times be very atypical. 
I illustrated this for logistic regression here:
http://www.stata.com/statalist/archive/2010-07/msg01596.html Michael
Norman Mitchell followed this with a very thoughtful post.
See also:
http://www.michaelnormanmitchell.com/stow/marginal-effect-at-mean-vs-
average-marginal-effect.html , which references an article by Maarten
Buis.

See also Maarten's post at:
http://www.stata.com/statalist/archive/2011-05/msg00838.html


Steve



Sorry. I once proved to myself that the KM (or Aalen) estimator of the survival function  could be close to Breslow's estimate, with x fixed at the mean.  But I long ago forgot how I did it. 

Steve

On Dec 8, 2012, at 1:37 PM, Oliver Eger wrote:

Dear Steve,

thanks again!

Could you give me any hint, where do the (small) differences between the Kaplan-Meier  associated estimated hazard function and the corresponding Cox model estimates with x equal to its mean actual result from? Mathematically?

Thanks!

Best
Oliver


----- Ursprüngliche Message -----
Von: Steve Samuels <[email protected]>
An: [email protected]
CC: 
Gesendet: 17:12 Mittwoch, 5.Dezember 2012
Betreff: Re: st: stcurve: why two different graphs?


Oliver,  If the proportional hazard assumption holds, The Kaplan-Meier curve and associated estimated hazard function will  be similar, but *not* identical to, the corresponding Cox model estimates when x is equal to its mean. 


Steve


On Dec 3, 2012, at 12:34 PM, Oliver Eger wrote:

Dear Steve,

thanks for your answer and your effort.
I think, I understand.



If I take the drugtr dataset and type for example
*******CODE BEGINS*********
stcox age, basehc(bhc)
stcurve, hazard title("age = mean")
*******CODE ENDS************

the resulting hazard ratio for age is 1.079845.
The mean of age is 57, weighted by number of persons: 55.875. So I get an identical graph by typing:

*******CODE BEGINS*********
stcox age, basehc(bhc2)
stcurve, hazard  at(age=55.875) title("age = 55.875")
*******CODE ENDS************
That’s clear.



For example, for age = 70.375 (55.875 + 14.5) one can calculate 1.079845^14.5 = 3.05, so the graph should show approximatively 3 times the values of the graphs above.
*******CODE BEGINS*********
stcox age, basehc(bhc3)
stcurve, hazard  at(age=70.375) title("age = 70.375")
*******CODE ENDS``*********
The graphical comparison seems to confirm this .

For example, for age = 25.875 (55.875 - 30) one can calculate 1 : (1.079845^30) = 0.1, so the graph should show 0.1 times the values of the first two graphs above.
*******CODE BEGINS*********
stcox age, basehc(bhc4)
stcurve, hazard  at(age=25.875) title("age = 25.875")
*******CODE ENDS************
The graphical comparison seems to confirm this again.

To come to the age=0 case:
For age = 0 one can calculate 1 : (1.079845^55.875) = 0.014, so the graph should show 0.014 times the values of the first two graphs above.
*******CODE BEGINS*********
stcox age, basehc(bhc5)
stcurve, hazard  at(age=0) title("age = 0")
*******CODE ENDS’’’*********
And again, the graphical comparison seems to confirm this approximatively.



So age=0 does in fact mean 0.014 times the hazard value of the “average model”
Can things be seen in this way? Then I “understand” may wrong way of thinking in the age=0 case.



This brings me to the following two questions:

1.)    The estimating of the baseline hazard function as described in Cleves et al, 3rd edition, “an introduction to survival analysis using stata”, page 139 - 143 for the cox model is the same as estimating the baseline hazard function in the non parametric case at page 113 - 116. Estimating the hazard function, i.e. including covariat(s), means nothing more than to multiply the baseline hazard function of the cox model by the value(s) of interest for the covariate(s) of interest. Right?

2.)    Doesn’t this mean, that the following two examples should give the same graphs? Or: where do the (small) differences in the two following graphs actual result from?

*******CODE BEGINS*********
stcox, estimate basehc(bhc6)
stcurve, hazard title("Smoothed Cox Baseline Hazard - no covariates")
*******CODE ENDS************

*******CODE BEGINS**********
stcox age, basehc(bhc7)
stcurve, hazard title("Cox  Age=mean")
*******CODE ENDS************



Best regards
Oliver


________________________________
Von: Steve Samuels <[email protected]>
An: [email protected] 
Gesendet: 21:25 Freitag, 30.November 2012
Betreff: Re: st: stcurve: why two different graphs?

This is for someone age = 0 The youngest age in the drug treatment
data set is 47, so the model is extrapolating way outside the range of
the data. Your mistake is in thinking that if a covariate has value zero, 
it is not in the model.  The "intercept" h0 is not the same
in the two models.


Simple example with regress.
*******************
input x y
40  40
50  50
60  60
end
regress y     // intercept is mean 
regress y x   // intercept is y value at x = 0
************** 

Steve

On Nov 30, 2012, at 2:25 PM, Oliver Eger wrote:

Dear Steve,


thanks for your answer!

I vow to improve my statalist questions next time;-)

Your stata commands with the drugtr example brings my question to the point.

*************CODE BEGINS*************
webuse drugtr, clear

stcox , estimate basehc(bhc)
sts graph,hazard  saving(g00.gph, replace) ///
title("Smoothed KM")
stcurve, hazard saving(g01, replace)  ///
title("Smoothed Cox Baseline Hazard")

*************CODE INTERRUPTED *******
The first two graphs are identical, I can understand that. Kaplan-Meier hazard graph = stcox null model graph.

But I don´t understand, why the third graph is different from the others:

*************CODE CONTINOUS *********
stcox age drug
stcurve, hazard at(age=0 drug=0)  ///
   title("Cox  Age=0 Drug=0")saving(g02, replace)

*************CODE ENDS **************

I have in mind the formula, given by the stata press book "an introduction to survival analysis using stata", third edition, by Cleves et al, page 129:

   h(t|xj) = h0(t) exp(xjßj)

If the covariates xj = 0, as in your third example, then only h0(t) remains in the formula and should give the same graph as your first and second example.

Why don´t they?

I would be happy, if you could help me.

Best regards
Oliver


________________________________
Von: Steve Samuels <[email protected]>
An: [email protected] 
Gesendet: 3:57 Dienstag, 16.Oktober 2012
Betreff: Re: st: stcurve: why two different graphs?

Dear Oliver:

The Statalist standard is to use full real
names. Please do so in the future.

We don't know what you saw, but models with and without covariates are
very different. Note that the FAQ ask that when you observe a problem,
you demonstrate it if possible on an available data set. Here is an
extreme counter-example, which works because age = 0 is outside the
range of the data.

*************CODE BEGINS*************
webuse
drugtr, clear

stcox , estimate basehc(bhc)
sts graph,hazard  saving(g00.gph, replace) ///
  title("Smoothed KM")
stcurve, hazard saving(g01, replace)  ///
  title("Smoothed Cox Baseline Hazard")
stcox age drug
stcurve, hazard at(age=0 drug=0)  ///
   title("Cox  Age=0 Drug=0")saving(g02, replace)
graph combine g00.gph g01.gph g02.gph,  ///
ycommon xcommon  saving(g03, replace)
**************CODE ENDS**************

Steve


On Oct 15, 2012, at 5:12 PM, [email protected] wrote:

Dear Statalisters,


unfortunately I got no answer yet, but maye now someone has an idea;-):

Stata command 

sts graph, hazard 

gives the same graph to me as

   stcox, estimate basehc(bhc)
stcurve, hazard

I can understand that.
Kaplan-Meier hazard graph = stcox null modell.

But, why don´t I get the same result, if I
write

   stcox var1 var2 var3 var4, basehc(bhc)
   stcurve, hazard at(var1=0 var2=0 var3=0 var4=0)

?

The graph is similar, but not identical. Is this not the same as above?


Thanks!

Best
Oliver

*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/faqs/resources/statalist-faq/http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/faqs/resources/statalist-faq/http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/faqs/resources/statalist-faq/http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/faqs/resources/statalist-faq/http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/faqs/resources/statalist-faq/http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/faqs/resources/statalist-faq/http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/faqs/resources/statalist-faq/http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/faqs/resources/statalist-faq/http://www.ats.ucla.edu/stat/stata/ ;           

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index