Learn R Programming

TraMineRextras (version 0.6.8)

plot.stslist.surv: Plot method for objects produced by the seqsurv function

Description

This is the plot method for objects of class stslist.surv produced by the seqsurv function.

Usage

# S3 method for stslist.surv
plot(x, cpal = NULL, ylab = NULL, xlab = NULL,
  xaxis = TRUE, yaxis = TRUE, xtstep = NULL, tick.last = NULL,
  ...)

Arguments

x

An object of class stslist.surv as produced by the seqsurv function.

cpal

Vector of colors. Alternative color palette to be used for the drawn lines. The vector should be of length equal to the number of drawn survival curves, i.e., the number of selected states or number of groups when x was obtained with per.state=TRUE. When cpal=NULL, the default colors assigned to the cpal attribute of x are used.

ylab

Optional label for the y axis. If set as NA, no label is displayed. If NULL, a default label is used.

xlab

Optional label for the x axis. If set as NA, no label is displayed. If NULL, a default label is used.

xaxis

Logical. Should the x-axis be plotted. Default is TRUE.

yaxis

Logical. Should the y-axis be plotted. Default is TRUE.

xtstep

Optional interval at which the tick-marks of the x-axis are displayed. For example, with xtstep = 3 a tick-mark is drawn at position 1, 4, 7, etc... The display of the corresponding labels depends on the available space and is dealt with automatically. If unspecified, the xtstep attribute of the x object is used.

tick.last

Logical. Should a tick mark be enforced at the last position on the x-axis? If unspecified, the tick.last attribute of the x object is used.

...

Further graphical parameters. For more details about the graphical parameter arguments, see plot, plot.default and par.

Author

Matthias Studer, Gilbert Ritschard, Pierre-Alexandre Fonta

Details

This is the plot method for the output produced by the seqsurv function, i.e., objects of class stslist.surv. It displays the survival curves fitted for states in sequences.

See Also

seqsurv, seqsplot, survfit.

Examples

Run this code
## Defining a sequence object with the data in columns 10 to 25
## (family status from age 15 to 30) in the biofam data set
data(biofam)
biofam.lab <- c("Parent", "Left", "Married", "Left+Marr",
"Child", "Left+Child", "Left+Marr+Child", "Divorced")
biofam.seq <- seqdef(biofam, 10:25, labels=biofam.lab)

## State survival plot
biofam.surv <- seqsurv(biofam.seq)
plot(biofam.surv)

Run the code above in your browser using DataLab