Stata 15 help for sts

[ST] sts -- Generate, graph, list, and test the survivor and cumulative hazard functions

Syntax

sts [graph] [if] [in] [, ...]

sts list [if] [in] [, ...]

sts test varlist [if] [in] [, ...]

sts generate newvar = ... [if] [in] [, ...]

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

See [ST] sts graph, [ST] sts list, [ST] sts test, and [ST] sts generate for details of syntax.

Description

sts reports and creates variables containing the estimated survivor and related functions, such as the Nelson-Aalen cumulative hazard function. For the survivor function, sts tests and produces Kaplan-Meier estimates or, via Cox regression, adjusted estimates.

sts graph is equivalent to typing sts by itself -- it graphs the survivor function.

sts list lists the estimated survivor and related functions.

sts test tests the equality of the survivor function across groups.

sts generate creates new variables containing the estimated survivor function, the Nelson-Aalen cumulative hazard function, or related functions.

sts can be used with single- or multiple-record or single- or multiple-failure st data.

Example: Listing, graphing, and generating variables

Setup . webuse stan3

Suppress showing of st settings . stset, noshow

List the survivor function . sts list

Graph the survivor function . sts graph

Create survf containing the survivor function . sts gen survf = s

Sort on the time variable . sort t1

List part of the data . list t1 survf in 1/10

Example: Comparing survivor or cumulative hazard functions

Graph the survivor functions for the two categories of posttran, showing results on one graph . sts graph, by(posttran)

Graph the Nelson-Aalen cumulative hazard functions for the two categories of posttran . sts graph, cumhaz by(posttran)

List the survivor functions for the two categories of posttran, including a number-who-enter column . sts list, by(posttran) enter

List the two categories of posttran side by side for the survivor function, selecting a subset of comparison times . sts list, by(posttran) compare

List the two categories of posttran side by side for the cumulative hazard function, selecting a subset of comparison times . sts list, cumhaz by(posttran) compare

List the two categories of posttran side by side for the survivor function, using the specified comparison times . sts list, by(posttran) compare at(0 100 to 1700)

Example: Testing equality of survivor functions

Perform log-rank test for equality of survivor functions . sts test posttran

Perform Wilcoxon test for equality of survivor functions . sts test posttran, wilcoxon

Example: Adjusted estimates

Setup . webuse drug2, clear

Suppress displaying of st settings . stset, noshow

Describe survival-time data . stdescribe

Show st settings . st

Summarize age and drug . summarize age drug

Graph the survivor functions for the two categories of drug . sts graph, by(drug)

Create variable containing the difference in age from 50 . generate age50 = age - 50

Graph the survivor functions for the two categories of drug adjusting for age by scaling to age 50 . sts graph, by(drug) adjustfor(age50)

List the information that sts graph just plotted, selecting a subset of comparison times . sts list, by(drug) adjustfor(age50) compare

Same as above, but adjust for age, not scaled to age 50 . sts list, by(drug) adjustfor(age) compare

Same as above, but constrain the effect of age50 to be the same across strata . sts list, by(drug) adjustfor(age50) compare

Example: Counting the number lost due to censoring

List the survivor function . sts list

Graph the survivor function, showing the number lost as small numbers on the plot . sts graph, lost

Setup . webuse stan3, clear

Suppress showing of st settings . stset, noshow

List the survivor functions for the two categories of posttran, including a number-who-enter column . sts list, by(posttran) enter

Same as above, but do not include the number-who-enter column . sts list, by(posttran)

List the survivor function, including a number-who-enter column . sts list, enter

List the survivor function, but do not include the number-who-enter column . sts list

Video examples

How to graph survival curves

How to calculate the Kaplan-Meier survivor and Nelson-Aalen cumulative hazard functions

How to test the equality of survivor functions using nonparametric tests

Stored results

See sts test for stored results details.


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