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

st: Sub-optimal smoothing behavior by stcurve?

From   "Dupont, William" <>
To   <>
Subject   st: Sub-optimal smoothing behavior by stcurve?
Date   Fri, 18 Nov 2005 10:46:20 -0600


I believe that the smoothing behavior for the hazard function plots of
-stcurve- is less than ideal near the time boundaries.  Consider the
program given below, which performs two analyses on the -drugtr- data
set from stata-press.  Analysis A shows a marked and steady increase in
hazard at times between 13 and 21.  Analysis B is the same as analysis A
except that all observations have been censored at time 17.  The hazard
curves from these analyses are similar until about time 13. At later
times, hazard A increases sharply while hazard B decreases sharply.  I
wonder if the latter behavior is due to the fact that the smoothing
algorithm at time 13 looks at some interval symmetric about 13,
recognizes that there are no failures to the right of 13 but fails to
see that there are no patients at risk at later times either.  

I have not attempted to read the -stcurve- code and realize that
devising smoothing algorithms can be non-trivial.  I wondered, however,
if the program was really working as the authors intended or it there
might be some way of improving its performance near the time boundaries.


William D. Dupont          phone: 615-343-4100          URL

*  Example of sub-optimal smoothing near a boundary for stcurve
log using stcurve.log, replace
set more on
use, clear
tabulate died
*  Analysis A
stcox drug, basehc(a)
stcurve, hazard outfile(a, replace)
replace died = died & studytime <= 17
replace studytime = min(17, studytime)
tabulate died
*  Analysis B
stcox drug, basehc(b) 
stcurve, hazard outfile(b, replace)
* Graph hazard estimates from both analyses together
use b, clear
rename haz1 hazcensored
merge _t using a, sort
sort _t
line haz1 hazcensored _t, xlabel(0(5)30) xtick(0(1)33)
log close

*   For searches and help try:

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