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

stnsgraph[if] [in] [,options]

optionsDescription ------------------------------------------------------------------------- Mainage(varname=name)varname specifies the age variable in the dataset; name that in the ratetableperiod(varname=name)varname specifies the survival time variable in the dataset; name that in the ratetablerate(name)name specifies the rate variable in the ratetablestrata(varlist)stratifies on different groups ofvarlist

by(varlist)estimates and graph separate functions for each group formed byvarlistcishows pointwise confidence bandsOptions

survivalgraphs net survival function; the defaultfailuregraphs net failure functioncumhazgraphs net cumulative hazard function

separateshows curves on separate graphs; default is to show curves one on top of anotherlevel(#)sets confidence level; default islevel(95)per(#)units to be used in reported ratesnoshowdoes not show st setting informationtmax(#)shows graph for t <=#tmin(#)shows graph for t >=#

atriskshows numbers at risk at beginning of each intervaloutfile(filename)saves the net survival function in the filename.dta databasecensored(single)show one hash mark at each censoring time, no matter what number is censoredcensored(number)shows one hash mark at each censoring time and number censored above hash markcensored(multiple)shows multiple hash marks for multiple censoring at the same timecensopts(hash_options)affects rendition of hash marksAt-risk table

risktableshows table of number at risk beneath graphrisktable(risk_spec)shows customized table of number at risk beneath graphatriskopts(marker_label_options)affects rendition of numbers at riskPlot

plotopts(cline_options)affects rendition of plotted linesplot#opts(cline_options)affects rendition of#th plotted line; may not be combined withseparateCI plot

ciopts(area_options)affects rendition of confidence bandsci#opts(area_options)affects rendition of#th confidence band; may not be combined withseparateAdd plots

addplot(plot)adds other plots to the generated graphY axis, X axis, Titles, Legend, Overall

twoway_optionsany options documented in[G-3]twoway_optionsbyopts(byopts)how subgraphs are combined, labeled, etc. -------------------------------------------------------------------------[

numlist][,table_optionsgroup(group)]

numlistspecifies the points at which the number at risk is to be evaluated,table_optionscustomizes the table of number at risk, andgroup(group)specifies a specific group/row fortable_optionsto be applied.

table_optionsDescription ------------------------------------------------------------------------- Mainaxis_label_optionscontrols table by using axis labeling options; seldom usedorder(order_spec)selects which rows appear and their orderrighttitlesplaces titles on right side of the tablefaileventsshows number failed in the at-risk tabletext_optionsaffects rendition of table elements and titlesRow titles

rowtitle([text][,rtext_options])changes title for a rowTitle

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

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

text_optionsDescription -------------------------------------------------------------------------size(textsizestyle)size of textcolor(colorstyle)color of textjustification(justificationstyle)text left-justified, centered, right-justifiedformat(%fmt)format values per%fmttopgap(relativesize)margin above rowsbottomgap(relativesize)margin beneath rows

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

rtext_optionsDescription -------------------------------------------------------------------------size(textsizestyle)size of textcolor(colorstyle)color of textjustification(justificationstyle)text left-justified, centered, right-justifiedat(#)override x position of titlestopgap(relativesize)margin above rows

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

ttext_optionsDescription -------------------------------------------------------------------------size(textsizestyle)size of textcolor(colorstyle)color of textjustification(justificationstyle)text left-justified, centered, right-justifiedat(#)override x position of titlestopgap(relativesize)margin above rowsbottomgap(relativesize)margin beneath rows

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

groupDescription -------------------------------------------------------------------------#rownumspecifies group by row number in tablevaluespecifies group by value of grouplabelspecifies group by text of value label associated with group -------------------------------------------------------------------------

hash_optionsDescription -------------------------------------------------------------------------line_optionschanges look of dropped linesmarker_label_optionsadds marker labels; any options documented in[G-3]marker_label_options, exceptmlabel()-------------------------------------------------------------------------

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

stns graphgraphs 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 graphfor details about graphical options.

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

age,period,rate, andstrataare required to estimate the net survival/failure function or net cumulative hazard stratified on variables invarlist.

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 invarlist.

ciincludes pointwise confidence bands. The default is not to produce these bands.

survival,failure, andcumhazspecify the function to graph.

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

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

cumhazspecifies that the estimate of the net cumulative hazard function be plotted.

separateis meaningful only withby(); 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 specifyci-- 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, specifyingper(100)results in rates per 100 person-years.

noshowpreventsstns graphfrom showing the key st variables. This option is seldom used because most people typestset, showorstset, noshowto 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.

atriskspecifies 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 thatcensored(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 withcensored(number),censopts()also specifies how the count of censoring is rendered; see[G-3]marker_label_options, exceptmlabel()is not allowed.

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

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

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

[ST] sts graphfor more details about these options.

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

See

[ST] sts graphfor details about these options.

Example: Graphing the net cumulative hazard functionSetup

. use rdata. stset survtime, failure(cens==1) id(id)Suppress showing st settings

. stset, noshowGraph 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 tableGraph the net survival functions for the two categories of

sexin one plot, including an at-risk table below the graph. stns graph, by(sex) risktableSame as above, but put the legend inside the plot rather than below it

. stns graph, by(sex) risktablelegend(ring(0) position(2) rows(2))Graph the net survival functions for the two categories of

sexin 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)))