Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: Issue with hazard function generated by sts graph

From   Steve Samuels <>
Subject   Re: st: Issue with hazard function generated by sts graph
Date   Tue, 6 Mar 2012 12:10:30 -0500

There's nothing strange here. You have a noisy graph, and you've focused only on a small part of it.  Remove the tmax(20) option to see the entire plot.  Set seed for reproducibility. The diagnostic for an exponential function with hazard = 1/5 is a cumulative hazard function in the form of a straight line, with a slope of 1/5. That's what you will see if you:

sts graph, cumhaz


On Mar 5, 2012, at 11:30 PM, Masashi Miyairi wrote:

Hi everyone,

I see something strange when plotting hazard rates by "sts graph, hazard". For example,  when I apply the command to a set of simulated exponential random variables, I get a graph that has a upward sloping part in the very beginning. In theory, this shouldn't be the case because exponential random variables have constant hazards, so the graph shouldn't have a increasing pattern. I am wondering if this issue has been documented, or I am missing something using this command. The following is the code that generates my puzzle.

set obs 5000
* Generate exponential random variables
gen dur = -5*log( uniform() )
* Plot the hazard rates
stset dur
sts graph, hazard tmax(20)

Thank you,
Masashi Miyairi
Department of Economics
University of Western Ontario

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index