Stata 15 help for stcoxkm

[ST] stcox PH-assumption tests -- Tests of proportional-hazards assumption

Syntax

Check proportional-hazards assumption:

Log-log plot of survival

stphplot [if] , {by(varname) | strata(varname)} [stphplot_options]

Kaplan-Meier and predicted survival plot

stcoxkm [if] , by(varname) [stcoxkm_options]

Using Schoenfeld residuals

estat phtest [, phtest_options]

stphplot_options Description ------------------------------------------------------------------------- Main * by(varname) fit separate Cox models; the default * strata(varname) fit stratified Cox model adjust(varlist) adjust to average values of varlist zero adjust to zero values of varlist; use with adjust()

Options nonegative plot ln{-ln(survival)} nolntime plot curves against analysis time noshow do not show st setting information

Plot plot#opts(stphplot_plot_options) affect rendition of the #th connected line and #th plotted points

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-3] twoway_options ------------------------------------------------------------------------- * Either by(varname) or strata(varname) is required with stphplot.

stphplot_plot_options Description ------------------------------------------------------------------------- cline_options change look of lines or connecting method marker_options change look of markers (color, size, etc.) -------------------------------------------------------------------------

stcoxkm_options Description ------------------------------------------------------------------------- Main * by(varname) report the nominal or ordinal covariate ties(breslow) use Breslow method to handle tied failures ties(efron) use Efron method to handle tied failures ties(exactm) use exact marginal-likelihood method to handle tied failures ties(exactp) use exact partial-likelihood method to handle tied failures separate draw separate plot for predicted and observed curves noshow do not show st setting information

Observed plot obsopts(stcoxkm_plot_options) affect rendition of the observed curve obs#opts(stcoxkm_plot_options) affect rendition of the #th observed curve; not allowed with separate

Predicted plot predopts(stcoxkm_plot_options) affect rendition of the predicted curve pred#opts(stcoxkm_plot_options) affect rendition of the #th predicted curve; not allowed with separate

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-3] twoway_options byopts(byopts) how subgraphs are combined, labeled, etc. ------------------------------------------------------------------------- * by(varname) is required with stcoxkm.

stcoxkm_plot_options Description ------------------------------------------------------------------------- connect_options change look of connecting method marker_options change look of markers (color, size, etc.) -------------------------------------------------------------------------

You must stset your data before using stphplot and stcoxkm; see [ST] stset. fweights, iweights, and pweights may be specified using stset; see [ST] stset.

phtest_options Description ------------------------------------------------------------------------- Main log use natural logarithm time-scaling function km use 1-KM product-limit estimate as the time-scaling function rank use rank of analysis time as the time-scaling function time(varname) use varname containing a monotone transformation of analysis time as the time-scaling function plot(varname) plot smoothed, scaled Schoenfeld residuals versus time bwidth(#) use bandwidth of #; default is bwidth(0.8) detail test proportional-hazards assumption separately for each covariate

Scatterplot marker_options change look of markers (color, size, etc.) marker_label_options add marker labels; change look or position

Smoothed line lineopts(cline_options) affect rendition of the smoothed line

Y axis, X axis, Titles, Legend, Overall twoway_options any options other than by() documented in [G-3] twoway_options ------------------------------------------------------------------------- estat phtest is not appropriate after estimation with svy.

Menu

stphplot

Statistics > Survival analysis > Regression models > Graphically assess proportional-hazards assumption

stcoxkm

Statistics > Survival analysis > Regression models > Kaplan-Meier versus predicted survival

estat phtest

Statistics > Survival analysis > Regression models > Test proportional-hazards assumption

Description

stphplot plots -ln{-ln(survival)} curves for each category of a nominal or ordinal covariate versus ln(analysis time). These are often referred to as "log-log" plots. Optionally, these estimates can be adjusted for covariates. The proportional-hazards assumption is not violated when the curves are parallel.

stcoxkm plots Kaplan-Meier observed survival curves and compares them with the Cox predicted curves for the same variable. The closer the observed values are to the predicted, the less likely it is that the proportional-hazards assumption has been violated.

estat phtest tests the proportional-hazards assumption on the basis of Schoenfeld residuals after fitting a model with stcox.

Options for stphplot

+------+ ----+ Main +-------------------------------------------------------------

by(varname) specifies the nominal or ordinal covariate. Either by() or strata() is required with stphplot.

strata(varname) is an alternative to by(). Rather than fitting separate Cox models for each value of varname, strata() fits one stratified Cox model. You must also specify adjust(varlist) with the strata(varname) option; see [ST] sts graph.

adjust(varlist) adjusts the estimates to that for the average values of the varlist specified. The estimates can also be adjusted to zero values of varlist by specifying the zero option. adjust(varlist) can be specified with by(); it is required with strata(varname).

zero is used with adjust() to specify that the estimates be adjusted to the 0 values of the varlist rather than to the average values.

+---------+ ----+ Options +----------------------------------------------------------

nonegative specifies that ln{-ln(survival)} be plotted instead of -ln{-ln(survival)}.

nolntime specifies that curves be plotted against analysis time instead of against ln(analysis time).

noshow prevents stphplot from showing the key st variables. This option is seldom used because most people type stset, show or stset, noshow to set whether they want to see these variables mentioned at the top of the output of every st command; see [ST] stset.

+------+ ----+ Plot +-------------------------------------------------------------

plot#opts(stphplot_plot_options) affects the rendition of the #th connected line and #th plotted points; see [G-3] cline_options and [G-3] marker_options.

+-----------+ ----+ Add plots +--------------------------------------------------------

addplot(plot) provides a way to add other plots to the generated graph; see [G-3] addplot_option.

+-----------------------------------------+ ----+ Y axis, X axis, Titles, Legend, Overall +--------------------------

twoway_options are any of the options documented in [G-3] twoway_options, excluding by(). These include options for titling the graph (see [G-3] title_options) and for saving the graph to disk (see [G-3] saving_option).

Options for stcoxkm

+------+ ----+ Main +-------------------------------------------------------------

by(varname) specifies the nominal or ordinal covariate. by() is required.

ties(breslow | efron | exactm | exactp) specifies one of the methods available to stcox for handling tied failures. If none is specified, ties(breslow) is assumed; see [ST] stcox.

separate produces separate plots of predicted and observed values for each value of the variable specified with by().

noshow prevents stcoxkm from showing the key st variables. This option is seldom used because most people type stset, show or stset, noshow to set whether they want to see these variables mentioned at the top of the output of every st command; see [ST] stset.

+---------------+ ----+ Observed plot +----------------------------------------------------

obsopts(stcoxkm_plot_options) affects the rendition of the observed curve; see [G-3] connect_options and [G-3] marker_options.

obs#opts(stcoxkm_plot_options) affects the rendition of the #th observed curve; see [G-3] connect_options and [G-3] marker_options. This option is not allowed with separate.

+----------------+ ----+ Predicted plot +---------------------------------------------------

predopts(stcoxkm_plot_options) affects the rendition of the predicted curve; see [G-3] connect_options and [G-3] marker_options.

pred#opts(stcoxkm_plot_options) affects the rendition of the #th predicted curve; see [G-3] connect_options and [G-3] marker_options. This option is not allowed with separate.

+-----------+ ----+ Add plots +--------------------------------------------------------

addplot(plot) provides a way to add other plots to the generated graph; see [G-3] addplot_option.

+-----------------------------------------+ ----+ Y axis, X axis, Titles, Legend, Overall +--------------------------

twoway_options are any of the options documented in [G-3] twoway_options, excluding by(). These include options for titling the graph (see [G-3] title_options) and for saving the graph to disk (see [G-3] saving_option).

byopts(byopts) affects the appearance of the combined graph when by() and separate are specified, including the overall graph title and the organization of subgraphs. See [G-3] by_option.

Options for estat phtest

+-------+ ----+ Main +------------------------------------------------------------

log, km, rank, and time() are used to specify the time scaling function.

By default, estat phtest performs the tests using the identity function, that is, analysis time itself.

log specifies that the natural log of analysis time be used.

km specifies that 1 minus the Kaplan-Meier product-limit estimate be used.

rank specifies that the rank of analysis time be used.

time(varname) specifies a variable containing an arbitrary monotonic transformation of analysis time. You must ensure that varname is a monotonic transform.

plot(varname) specifies that a scatterplot and smoothed plot of scaled Schoenfeld residuals versus time be produced for the covariate specified by varname. By default, the smoothing is performed using the running-mean method implemented in lowess, mean noweight; see [R] lowess.

bwidth(#) specifies the bandwidth. Centered subsets of bwidth()*N observations are used for calculating smoothed values for each point in the data except for endpoints, where smaller, uncentered subsets are used. The greater the bwidth(), the greater the smoothing. The default is bwidth(0.8).

detail specifies that a separate test of the proportional-hazards assumption be produced for each covariate in the Cox model. By default, estat phtest produces only the global test.

+--------------+ ----+ Scatterplot +-----------------------------------------------------

marker_options affect the rendition of markers drawn at the plotted points, including their shape, size, color, and outline; see [G-3] marker_options.

marker_label_options specify if and how the markers are to be labeled; see [G-3] marker_label_options.

+---------------+ ----+ Smoothed line +----------------------------------------------------

lineopts(cline_options) affects the rendition of the smoothed line; see [G-3] cline_options.

+------------------------------------------+ ----+ Y axis, X axis, Titles, Legend, Overall +-------------------------

twoway_options are any of the options documented in [G-3] twoway_options, excluding by(). These include options for titling the graph (see [G-3] title_options) and for saving the graph to disk (see [G-3] saving_option).

Examples

--------------------------------------------------------------------------- Setup . webuse leukemia . stset weeks, failure(relapse) noshow

Check proportional-hazards assumption for treatment1 using stphplot . stphplot, by(treatment1)

Same as above, but adjust for white-blood-cell count . stphplot, by(treatment1) adj(wbc2 wbc3)

Check proportional-hazards assumption for treatment1 using stcoxkm . stcoxkm, by(treatment1)

Check proportional-hazards assumption for treatment2 using stphplot . stphplot, by(treatment2)

Check proportional-hazards assumption for treatment2 using stcoxkm . stcoxkm, by(treatment2) separate

--------------------------------------------------------------------------- Setup . webuse leukemia

Declare data to be survival-time data . stset weeks, failure(relapse)

Fit Cox model . stcox treatment2 wbc2 wbc3

Test proportional-hazards assumption based on Schoenfeld residuals . estat phtest, rank detail

---------------------------------------------------------------------------

Video example

How to fit a Cox proportional hazards model and check proportional-hazards assumption

Stored results

estat phtest stores the following in r():

Scalars r(df) global test degrees of freedom r(chi2) global test chi-squared r(p) global test p-value

Matrices r(phtest) separate tests for each covariate


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