help stcurve dialog: stcurve
-------------------------------------------------------------------------------
Title
[ST] stcurve -- Plot survivor, hazard, cumulative hazard, or cumulative
incidence function
Syntax
stcurve [, stcurve_options]
stcurve_options description
-------------------------------------------------------------------------
Main
* survival plot survivor function
* hazard plot hazard function
* cumhaz plot cumulative hazard function
* cif plot cumulative incidence function
at(varname=# [varname=# ...]) value of the specified covariates and
[at1(varname=# [varname=# ...]) mean of unspecified covariates
[at2(varname=# [varname=# ...])
[...]]]
Options
alpha1 conditional frailty model
unconditional unconditional frailty model
range(# #) range of analysis time
outfile(filename [, replace]) save values used to plot the curves
width(#) override "optimal" width; use with
hazard
kernel(kernel) kernel function; use with hazard
noboundary no boundary correction; use with
hazard
Plot
connect_options affect rendition of plotted survivor,
hazard, or cumulative hazard
function
Add plots
addplot(plot) add other plots to the generated
graph
Y axis, X axis, Titles, Legend, Overall
twoway_options any options other than by()
documented in [G] twoway_options
-------------------------------------------------------------------------
* One of survival, hazard, cumhaz, or cif must be specified.
survival and hazard are not allowed after estimation with stcrreg.
cif is allowed only after estimation with stcrreg.
Menu
Statistics > Survival analysis > Regression models > Plot survivor,
hazard, cumulative hazard, or cumulative incidence function
Description
stcurve plots the survivor, hazard, or cumulative hazard function after
stcox or streg and plots the cumulative subhazard or cumulative incidence
function after stcrreg.
Options
+------+
----+ Main +-------------------------------------------------------------
survival requests that the survivor function be plotted. survival is not
allowed after estimation with stcrreg.
hazard requests that the hazard function be plotted. hazard is not
allowed after estimation with stcrreg.
cumhaz requests that the cumulative hazard function be plotted when used
after stcox or streg and requests that the cumulative subhazard
function be plotted when used after stcrreg.
cif requests that the cumulative incidence function be plotted. This
option is available only after estimation with stcrreg.
at(varname=# ...) requests that the covariates specified by varname be
set to #. By default, stcurve evaluates the function by setting each
covariate to its mean value. This option causes the function to be
evaluated at the value of the covariates listed in at() and at the
mean of all unlisted covariates.
at1(varname=# ...), at2(varname=# ...), ..., at10(varname=# ...)
specify that multiple curves (up to 10) be plotted on the same graph.
at1(), at2(), ..., at10() work like the at() option. They request
that the function be evaluated at the value of the covariates
specified and at the mean of all unlisted covariates. at1()
specifies the values of the covariates for the first curve, at2()
specifies the values of the covariates for the second curve, and so
on.
+---------+
----+ Options +----------------------------------------------------------
alpha1, when used after fitting a frailty model, plots curves that are
conditional on a frailty value of one. This is the default for
shared-frailty models.
unconditional, when used after fitting a frailty model, plots curves that
are unconditional on the frailty; i.e., the curve is "averaged" over
the frailty distribution. This is the default for unshared-frailty
models.
range(# #) specifies the range of the time axis to be plotted. If this
option is not specified, stcurve plots the desired curve on an
interval expanding from the earliest to the latest time in the data.
outfile(filename [, replace]) saves in filename.dta the values used to
plot the curve(s).
width(#) is for use with hazard (and applies only after stcox) and is
used to specify the bandwidth to be used in the kernel smooth used to
plot the estimated hazard function. If left unspecified, a default
bandwidth is used, as described in [R] kdensity.
kernel(kernel) is for use with hazard and is for use only after stcox
because, for Cox regression, an estimate of the hazard function is
obtained by smoothing the estimated hazard contributions. kernel()
specifies the kernel function for use in calculating the weighted
kernel-density estimate required to produce a smoothed
hazard-function estimator. The default is kernele(Epanechnikov), yet
kernel may be any of the kernels supported by kdensity; [R] kdensity.
noboundary is for use with hazard and applies only to the plotting of
smoothed hazard functions after stcox. It specifies that no
boundary-bias adjustments are to be made when calculating the
smoothed hazard-function estimator. By default, the smoothed hazards
are adjusted near the boundaries; see [ST] sts graph. If the epan2,
biweight, or rectangular kernel is used, the bias correction near the
boundary is performed using boundary kernels. For other kernels, the
plotted range of the smoothed hazard function is restricted to be
inside of one bandwidth from each endpoint. For these other kernels,
specifying noboundary merely removes this range restriction.
+------+
----+ Plot +-------------------------------------------------------------
connect_options affect the rendition of the plotted survivor, hazard, or
cumulative hazard function; see [G] connect_options.
+-----------+
----+ Add plots +--------------------------------------------------------
addplot(plot) provides a way to add other plots to the generated graph;
see [G] addplot_option.
+-----------------------------------------+
----+ Y axis, X axis, Titles, Legend, Overall +--------------------------
twoway_options are any of the options documented in [G] twoway_options,
excluding by(). These include options for titling the graph (see [G]
title_options) and for saving the graph to disk (see [G]
saving_option).
Examples after stcox
Setup
. webuse drugtr
Fit Cox model
. stcox age drug
Plot the estimated survivor function
. stcurve, survival
Plot the estimated survivor function for the placebo group and for the
treatment group
. stcurve, survival at1(drug=0) at2(drug=1)
Plot the estimated hazard function for the placebo group and for the
treatment group on a log scale
. stcurve, hazard at1(drug=0) at2(drug=1) kernel(gauss) yscale(log)
Examples after streg
---------------------------------------------------------------------------
Setup
. webuse cancer, clear
Map values for drug into 0 for placebo and 1 for nonplacebo
. replace drug = drug == 2 | drug == 3
Fit a loglogistic survival model
. streg age drug, d(llog)
Plot the survivor function
. stcurve, survival ylabels(0 .5 1)
Plot the hazard function
. stcurve, hazard
Plot the survivor function for the placebo group and for the treatment
group
. stcurve, survival at1(drug=0) at2(drug=1) ylabels(0 .5 1)
---------------------------------------------------------------------------
Setup
. webuse catheter, clear
Declare data to be survival-time data
. stset time infect
Fit a Weibull/inverse-Gaussian shared-frailty model
. streg age female, d(weibull) frailty(invgauss) shared(patient)
Plot the individual hazard function for females at mean age
. stcurve, hazard at(female=1) alpha1
Plot the population hazard function for females at mean age
. stcurve, hazard at(female=1) unconditional
---------------------------------------------------------------------------
Example after stcrreg
Setup
. webuse hypoxia, clear
Declare data to be survival-time data
. stset dftime, failure(failtype==1)
Fit competing-risks model
. stcrreg ifp tumsize pelnode, compete(failtype==2)
Compare cumulative incidence functions for two groups with remaining
covariates held at their mean values
. stcurve, cif at1(pelnode=0) at2(pelnode=1)
Also see
Manual: [ST] stcurve
Help: [ST] stcox, [ST] stcox postestimation, [ST] stcrreg, [ST]
stcrreg postestimation, [ST] streg, [ST] streg postestimation;
[ST] sts, [ST] stset