Title

stns graph -- Graph the net survival and net cumulative hazard functions

Syntax

stns graph [if] [in] [, options]

options Description ------------------------------------------------------------------------- Main age(varname=name) varname specifies the age variable in the dataset; name that in the ratetable period(varname=name) varname specifies the survival time variable in the dataset; name that in the ratetable rate(name) name specifies the rate variable in the ratetable strata(varlist) stratifies on different groups of varlist

by(varlist) estimates and graph separate functions for each group formed by varlist ci shows pointwise confidence bands

Options survival graphs net survival function; the default failure graphs net failure function cumhaz graphs net cumulative hazard function

separate shows curves on separate graphs; default is to show curves one on top of another level(#) sets confidence level; default is level(95) per(#) units to be used in reported rates noshow does not show st setting information tmax(#) shows graph for t <= # tmin(#) shows graph for t >= #

atrisk shows numbers at risk at beginning of each interval outfile(filename) saves the net survival function in the filename.dta database censored(single) show one hash mark at each censoring time, no matter what number is censored censored(number) shows one hash mark at each censoring time and number censored above hash mark censored(multiple) shows multiple hash marks for multiple censoring at the same time censopts(hash_options) affects rendition of hash marks

At-risk table risktable shows table of number at risk beneath graph risktable(risk_spec) shows customized table of number at risk beneath graph atriskopts(marker_label_options) affects rendition of numbers at risk

Plot plotopts(cline_options) affects rendition of plotted lines plot#opts(cline_options) affects rendition of #th plotted line; may not be combined with separate

CI plot ciopts(area_options) affects rendition of confidence bands ci#opts(area_options) affects rendition of #th confidence band; may not be combined with separate

Add plots addplot(plot) adds other plots to the generated graph

Y axis, X axis, Titles, Legend, Overall twoway_options any options documented in [G-3] twoway_options byopts(byopts) how subgraphs are combined, labeled, etc. -------------------------------------------------------------------------

where risk_spec is

[numlist][, table_options group(group)]

numlist specifies the points at which the number at risk is to be evaluated, table_options customizes the table of number at risk, and group(group) specifies a specific group/row for table_options to be applied.

table_options Description ------------------------------------------------------------------------- Main axis_label_options controls table by using axis labeling options; seldom used order(order_spec) selects which rows appear and their order righttitles places titles on right side of the table failevents shows number failed in the at-risk table text_options affects rendition of table elements and titles

Row titles rowtitle([text][, rtext_options]) changes title for a row

Title title([text][, ttext_options]) changes overall table title -------------------------------------------------------------------------

where order_spec is

# ["text" ["text" ...]] [...]

text_options Description ------------------------------------------------------------------------- size(textsizestyle) size of text color(colorstyle) color of text justification(justificationstyle) text left-justified, centered, right-justified format(%fmt) format values per %fmt topgap(relativesize) margin above rows bottomgap(relativesize) margin beneath rows

style(textstyle) overall style of text ------------------------------------------------------------------------- style() does not appear in the dialog box.

rtext_options Description ------------------------------------------------------------------------- size(textsizestyle) size of text color(colorstyle) color of text justification(justificationstyle) text left-justified, centered, right-justified at(#) override x position of titles topgap(relativesize) margin above rows

style(textstyle) overall style of text ------------------------------------------------------------------------- style() does not appear in the dialog box.

ttext_options Description ------------------------------------------------------------------------- size(textsizestyle) size of text color(colorstyle) color of text justification(justificationstyle) text left-justified, centered, right-justified at(#) override x position of titles topgap(relativesize) margin above rows bottomgap(relativesize) margin beneath rows

style(textstyle) overall style of text ------------------------------------------------------------------------- style() does not appear in the dialog box.

group Description ------------------------------------------------------------------------- #rownum specifies group by row number in table value specifies group by value of group label specifies group by text of value label associated with group -------------------------------------------------------------------------

hash_options Description ------------------------------------------------------------------------- line_options changes look of dropped lines marker_label_options adds marker labels; any options documented in [G-3] marker_label_options, except mlabel() -------------------------------------------------------------------------

risktable() may be repeated and is merged-explicit group; see repeated options. You must stset your data before using stns graph; see [ST] stset.

Description

stns graph graphs the estimated net survival (failure) function or the estimated net cumulative (integrated) hazard function. See stns for an introduction to this command and [ST] sts graph for details about graphical options.

Options

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

age, period, rate, and strata are required to estimate the net survival/failure function or net cumulative hazard stratified on variables in varlist.

by(varlist) estimates a separate function for each by-group and plots all the functions on one graph. By-groups are identified by equal values of the variables in varlist.

ci includes pointwise confidence bands. The default is not to produce these bands.

survival, failure, and cumhaz specify the function to graph.

survival specifies that the net survival function be plotted. This option is the default if a function is not specified.

failure specifies that the net failure function, 1 - S(t+0), be plotted.

cumhaz specifies that the estimate of the net cumulative hazard function be plotted.

separate is meaningful only with by(); it requests that each group be placed on its own rather than one on top of the other. Sometimes curves have to be placed on separate graphs -- such as when you specify ci -- because otherwise it would be too confusing.

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

level(#) specifies the confidence level, as a percentage, for the pointwise confidence interval around the net survival, net failure, or net cumulative hazard function; see [R] level.

per(#) specifies the units used to report the net survival or failure rates. For example, if the analysis time is in years, specifying per(100) results in rates per 100 person-years.

noshow prevents stns graph 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.

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

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

atrisk specifies that the numbers at risk at the beginning of each interval be shown on the plot. The numbers at risk are shown as small numbers beneath the flat parts of the plotted function.

censored(single | number | multiple) specifies that hash marks be placed on the graph to indicate censored observations.

censored(single) places one hash mark at each censoring time, regardless of the number of censorings at that time.

censored(number) places one hash mark at each censoring time and displays the number of censorings about the hash mark.

censored(multiple) places multiple hash marks for multiple censorings at the same time. For instance, if 3 observations are censored at time 5, three hash marks are placed at time 5. censored(multiple) is intended for use when there are few censored observations; if there are too many censored observations, the graph can look bad. In such cases, we recommend that censored(number) be used.

censopts(hash_options) specifies options that affect how the hash marks for censored observations are rendered; see [G-3] line_options. When combined with censored(number), censopts() also specifies how the count of censoring is rendered; see [G-3] marker_label_options, except mlabel() is not allowed.

+---------------+ ----+ At-risk table +----------------------------------------------------

risktable[([numlist][, table_options])] displays a table showing the number at risk beneath the plot. risktable may not be used with separate.

atriskopts(marker_label_options) specifies options that affect how the numbers at risk are rendered; see [G-3] marker_label_options. This option implies the atrisk option.

See [ST] sts graph for more details about these options.

+-------------------------------------------------------------------+ ----+ Plot, CI plot, Add plots, Y axis, X axis, Titles, Legend, Overall +

See [ST] sts graph for details about these options.

Example: Graphing the net cumulative hazard function

Setup . use rdata . stset survtime, failure(cens==1) id(id)

Suppress showing st settings . stset, noshow

Graph the net survival function for the two categories of sex . stns graph using myslopop, age(agediag=age) period(datediag=year) rate(rate) strata(sex) by(sex)

Now graph the net cumulative hazard functions for the two categories of sex . stns graph, cumhaz by(sex)

Example: Adding an at-risk table

Graph the net survival functions for the two categories of sex in one plot, including an at-risk table below the graph . stns graph, by(sex) risktable

Same as above, but put the legend inside the plot rather than below it . stns graph, by(sex) risktable legend(ring(0) position(2) rows(2))

Graph the net survival functions for the two categories of sex in one plot, including an at-risk table below the graph and using the specified row titles and order of rows for the at-risk table . stns graph, by(sex) risktable(, order(1 "male" 2 "female"))

Same as above, but left-justify the row titles in the at-risk table . stns graph, by(sex) risktable(, order(1 "male" 2 "female") rowtitle(, justification(left)))

Same as above, but align the table title with the rwo titles . stns graph, by(sex) risktable(, order(1 "male" 2 "female") rowtitle(, justification(left)) title(, at(rowtitle)))