.-
help for ^sts^                                              (manual:  ^[R] st sts^)
.-

Generate, graph, list, and test the (Kaplan-Meier) survivor function 
--------------------------------------------------------------------

    ^sts g^raph   [^if^ exp] [^in^ range] 
		[^, by(^varlist^) st^rata^(^varlist^) ad^justfor^(^varlist^) nola^bel 
                   ^f^ailure ^gw^ood ^na cna^ ^l^evel^(^#^) lost enter sep^arate
                   ^tmi^n^(^#^) tma^x^(^#^)^ ^xas^is ^yas^is ^nob^order ^nosh^ow ^noori^gin ^atr^isk
                   ^cen^sored^(s^ingle | ^n^umber | ^m^ultiple^)^ graph_options ]

    ^sts l^ist    [^if^ exp] [^in^ range]
		[^, by(^varlist^) st^rata^(^varlist^) ad^justfor^(^varlist^)^ ^na^
		   ^f^ailure ^at(^#|numlist^) c^ompare ^e^nter ^l^evel^(^#^) nosh^ow ]

    ^sts t^est    varlist [^if^ exp] [^in^ range] 
		[^,^ [^l^ogrank|^w^ilcoxon|^c^ox] ^st^rata^(^varlist^) d^etail
		   ^mat(^matname1 matname2^) not^itle ^nosh^ow ]

    ^sts gen^erate newvar ^=^ { ^s^ | ^se(s)^ | ^h^ | ^se(lls)^ | ^lb(s)^ | ^ub(s)^ | ^n^ | ^d^ |
                            ^na^ | ^se(na)^ | ^lb(na)^ | ^ub(na)^ }
	        [newvar ^=^ { ... } [...] ] [^if^ exp] [^in^ range]
		[^, by(^varlist^) st^rata^(^varlist^) ad^justfor^(^varlist^) l^evel^(^#^)^ ]


^sts^, typed by itself, is equivalent to typing ^sts graph^.

^sts^ is for use with survival-time data; see help @st@.  You must have ^stset^ your
data before using this command; see help @stset@.


Examples:

Graph the Kaplan-Meier survivor function:       . ^sts graph^
						. ^sts graph, by(drug)^

List the Kaplan-Meier survivor function:        . ^sts list^
						. ^sts list, by(drug)^
						. ^sts list, by(drug) compare^

Graph the Nelson-Aalen cum. hazard function:    . ^sts graph, na^
                                                . ^sts graph, na cna^
						. ^sts graph, na by(drug)^

List the Nelson-Aalen cum. hazard function:     . ^sts list, na^
						. ^sts list, na by(drug)^
						. ^sts list, na by(drug) compare^

Test equality of survivor functions:            . ^sts test drug^
						. ^sts test drug, strata(agecat)^

Generate variable containing Kaplan-Meier       . ^sts gen surv = s^
survivor function:                              . ^sts gen surv = s, by(drug)^

Generate variable containing Nelson-Aalen       . ^sts gen nelson = na^
cumulative hazard function:                     . ^sts gen nelson = na, by(drug)^



Description 
-----------

^sts^ reports on and creates variables containing the estimated survivor
(failure) function or the Nelson-Aalen cumulative hazard function.  In the
case of the survivor (failure) function, ^sts^ can run tests and produce
Kaplan-Meier estimates or, via Cox regression, adjusted estimates.

^sts graph^ graphs the estimated survivor or Nelson-Aalen cumulative hazard
function.

^sts list^ lists the estimated survivor or Nelson-Aalen cumulative hazard
function.

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

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


Options common to ^sts graph^, ^list^, and ^test^
-------------------------------------------

^noshow^ prevents ^sts^ from displaying the identities of the key st variables
    above its output.  If this appeals to you, consider typing "^stset, noshow^"
    to make ^noshow^ the default for all st commands; see help @stset@.

    ^noshow^ is not allowed with ^sts generate^; it is ^noshow^ by default.



Options common to ^sts graph^, ^list^, and ^generate^
-----------------------------------------------

^by(^varlist^)^ produces separate functions by making separate calculations
    for each group identified by equal values of the ^by()^ variables.

^strata(^varlist^)^ is a subtle alternative to ^by()^ allowed only when you also
    specify the ^adjustfor()^ option.  This is described below.

^na^ specifies that the cumulative hazard function be calculated using the
    Nelson-Aalen estimator.

^adjustfor(^varlist^)^ adjusts the estimates of the survivor function to that for
    0 values of the ^adjustfor()^ variables. This option is not available with
    the ^na^ option.

    If you do not specify ^by()^ or ^strata()^, a Cox regression is estimated and
    the baseline function retrieved.

    If you specify ^by()^, separate Cox regressions are estimated for each group
    and the separately estimated baseline functions retrieved.

    If you specify ^strata()^, a single stratified Cox regression is estimated
    and the stratified baseline function retrieved.


Options unique to ^sts graph^
---------------------------

^nolabel^ is meaningful only with ^by()^ or ^strata()^; it prevents ^sts graph^ from
    labeling the group of the survival curves.

^failure^ specifies that you want 1-S(t+0), the failure function, graphed.

^gwood^ indicates that you want pointwise confidence bands drawn around the
    survivor (failure) function.  ^gwood^ is not allowed if you specify
    ^adjustfor()^, nor is it allowed with pweighted data.

^cna^ indicates that you want pointwise confidence bands drawn around the
    Nelson-Aalen cumulative hazard function.  ^cna^ is not allowed with
    pweighted data.

^level(^#^)^ specifies the confidence level, in percent, for the Greenwood 
    pointwise confidence interval of the survivor (failure) function or for
    the pointwise confidence interval of the Nelson-Aalen cumulative hazard
    function; see help @level@.

^lost^ specifies that you wish the number lost shown on the plot.  If you do
    not also specify ^enter^, the numbers displayed are the
    censored-minus-entered, the effective number lost.  If you specify
    ^enter^, the numbers displayed are the pure number censored.  The logic
    underlying this is described in ^[R] st sts^.

^enter^ specifies that the number who enter are to be shown on the graph as well
    as the number censored.

^atrisk^ specifies that the number at risk at the beginning of the interval be
    shown on the plot.

^censored(single^ | ^number^ | ^multiple)^ specifies that tick marks be place
    on the graph to indicate censored observations. 

    ^censored(single)^ places one tick at each censoring time regarless of the
    number of censorings at that time.

    ^censored(number)^ places one tick at each censoring time and displays the
    number of censorings above the tick. 

    ^censored(multiple)^ places multiple ticks for multiple censorings at the
    same time.  If three observations are censored at time 5, then three ticks
    are placed around time 5.  ^censored(multiple)^ is intended for use when
    there are few censored observations; if there are too many, the graph can
    look bad and in such cases we recommend that ^censored(number)^ be used.

^noorigin^ causes the plotting of the survival (failure) curve to begin at the
    first exit time instead of beginning at t=0.  By default ^sts graph^ will
    plot from t=0. This option is ignored when ^na^ or ^cna^ are specified.

^separate^ is meaningful only with ^by()^ or ^strata()^; it says that each group
    should be placed on its own graph rather than one on top of the other.

^tmin(^#^)^ specifies that the plotted curve is to be graphed only for 
    t >= #.  This option does not affect the calculation of the function.

^tmax(^#^)^ specifies that the plotted curve is to be graphed only for 
    t <= #.  This option does not affect the calculation of the function.

^xasis^ and ^yasis^ prevent ^sts graph^ from attempting to produce better labels 
    for the axes other than the minimum and maximum.  ^yasis^ is especially
    important.  By default, ^sts graph^ scales the vertical (probability) axis
    to include 0 to 1.  ^yasis^ prevents that.

^noborder^ is ^graph^'s border option, but turned around; see help @graph@.


Options unique to ^sts list^
--------------------------

^failure^ specifies that you want 1-S(t+0), the failure function, listed.

^at(^#|numlist^)^ specifies the time values at which the estimated survivor
    (failure) function is to be listed.  The default is to list the function
    at all the unique time values in the data or, if functions are being
    compared, at about 10 times chosen over the observed interval.

    ^at(5 10 20 30 50 90)^ displays the function at the designated times.

    ^at(10 20 to 100)^ displays the function at times 10, 20, 30, ..., 100.

    ^at(0 5 10 to 100 200)^ displays the function at times 0, 5, 10, 20, ..., 
    100, and 200.

    See help @numlist@ for more information on specifying numlists.

    ^at(20)^ displays the function at roughly 20 equally spaced times.

^compare^ is specified only with ^by()^ or ^strata()^.  It states that you wish the
    survival functions listed side-by-side rather than one and then the next.

^enter^ specifies that you want the table to contain the number who enter and,
    correspondingly, that the number lost is to be displayed as the pure number
    lost; see ^[R] st sts^.


Options unique to ^sts test^
--------------------------

^logrank^, ^wilcoxon^, and ^cox^ specify which test of equality is desired.  ^logrank^
    is the default unless the data is pweighted, in which case ^cox^ is the 
    default and only possibility.

^strata(^varlist^)^ requests that a stratified test be performed.

^detail^ modifies ^strata()^; it requests that, in addition to reporting the
    overall stratified test, the tests for the individual strata be reported
    as well.  ^detail^ is not allowed with ^cox^.

^mat(^matname1 matname2^)^ is not allowed with ^cox^.  The other two tests are rank
    tests of the form u'V^^(-1)u.  ^mat()^ requests that vector u be placed in
    matname1 and V in matname2.

^notitle^ requests that the title printed above the test be suppressed.


Functions for ^sts generate^
--------------------------

^s^ produces the Kaplan-Meier product-limit estimate of the survivor function
    or, if ^adjustfor()^ is specified, the baseline survivor function from a Cox
    regression on the ^adjustfor()^ variables.

^se(s)^ produces the Greenwood, pointwise standard error.  Option ^adjustfor()^
    is not allowed in this case.

^h^ produces the product-limit estimate of the hazard function.

^se(lls)^ produces the standard error of ln[-ln S(t)].

^lb(s)^ produces the lower bound of the confidence interval for S(t) based on 
    the ln[-ln S(t)].

^ub(s)^ produces the corresponding upper bound.

^na^ produces the Nelson-Aalen estimate of the cumulative hazard function.
     Option ^adjustfor()^ is not allowed in this case.

^se(na)^ produces pointwise standard error for the Nelson-Aalen estimate of
     the cumulative hazard function, H(t). Option ^adjustfor()^ is not allowed in
     this case.

^lb(na)^ produces the lower bound of the confidence interval for H(t) based on 
    the log-transformed cumulative hazard function.

^ub(na)^ produces the corresponding upper bound.

^n^ produces the size of the population alive at each time.

^d^ produces the number failing at each time.

^level(^#^)^ specifies the confidence level, in percent, for confidence intervals.


Examples
--------

	. ^sts^
	. ^sts,na^
	. ^sts graph^
	. ^sts graph, by(posttran)^
	. ^sts graph, na  by(posttran)^

	. ^sts list^
	. ^sts list, na^
	. ^sts list, by(posttran)^
	. ^sts list, by(posttran) compare^
	. ^sts list, by(posttran) compare at(0 100 to 1700)^
	. ^sts list, na by(posttran) compare at(0 100 to 1700)^

	. ^sts test posttran^
	. ^sts test posttran, wilcoxon^

	. ^gen age50 = age - 50^
	. ^sts graph, by(drug) adjustfor(age50)^
	. ^sts graph, strata(drug) adjustfor(age50)^
	. ^sts list, by(drug) adjustfor(age50) compare^
	. ^sts list, strata(drug) adjustfor(age50) compare^


Also see
--------

 Manual:  ^[R] st sts^
	  ^[R] st sts generate^
	  ^[R] st sts graph^
	  ^[R] st sts list^
	  ^[R] st sts test^
    STB:  ^stata53^ (STB-50)
On-line:  help for @st@, @stcox@, @stgen@
