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

Re: st: sts graph, na yscale(log) vs stphplot


From   [email protected] (Jean Marie Linhart, StataCorp.)
To   [email protected]
Subject   Re: st: sts graph, na yscale(log) vs stphplot
Date   Tue, 27 May 2003 13:47:49 -0500

"JAC Sterne, Social Medicine" <[email protected]> wrote

> Stata provides two graphical methods to assess the proportional
> hazards assumption (1) graphing the cumulative hazards on a log
> scale using -sts graph, na yscale(log) or (2) using the stphplot
> command. Although the point estimates are derived in different ways
> these two methods are equivalent because log(cumulative hazard) is
> the same as log(-log(survival).
>
> I prefer (1), because it is easier to understand why graphs of
> log(cumulative hazard) should be parallel if the proportional
> hazards function is true. However, there seems to be a problem with
> the graph produced by sts graph, na yscale(log) in Stata 8. Because
> the cumulative hazard (by definition) starts at 0, the graph gets
> squeezed up to the top unless you start plotting beyond the time of
> the first event using the tmin() option. And when comparing
> cumulative hazards in several groups this means starting beyond the
> minimum time in all groups, which if one of the groups is small may
> mean omitting much of the data.
>
> Have I (a) misunderstood, or (b) missed an easy workaround? Or is
> this a bug/feature requiring improvement?

I have to admit that when I looked at a graph that included 0 with the
-yscale(log)- option the first time, I thought that graph was doing
something wrong too.  A bit of reflection reveals it is not doing
anything wrong, it is handling the mathematical fact that log(0) is
negative infinity as best it can.  When you ask graphics to do a
-yscale(log)- plot including 0 on the axis, everything else gets
smooshed up to the top, exactly as it should if you actually plotted
negative infinity in on your graph.  To negative infinity, all finite
numbers look the same.

If your data includes 0, the graph is going to include log(0) on the
axis; there's no getting around it.

Consequently, I think your best option may be to use stphplot.

--Jean Marie
[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