relsurv (version 2.2-3)

plot.cmp.rel: Plot the crude probability of death

Description

Plot method for cmp.rel. Plots the cumulative probability of death due to disease and due to population reasons

Usage

# S3 method for cmp.rel
plot(x, main, curvlab, ylim=c(0, 1), xlim, wh=2, xlab="Time (days)",
	 ylab="Probability", lty=1:length(x), xscale=1,col=1, lwd=par('lwd'),
	 curves, conf.int, all.times=FALSE,...)

Arguments

x

a list, with each component representing one curve in the plot, output of the function cmp.rel.

main

the main title for the plot.

curvlab

Curve labels for the plot. Default is names(x), or if that is missing, 1:nc, where nc is the number of curves in x.

ylim

yaxis limits for plot.

xlim

xaxis limits for plot (default is 0 to the largest time in any of the curves).

wh

if a vector of length 2, then the upper right coordinates of the legend; otherwise the legend is placed in the upper right corner of the plot.

xlab

X axis label.

ylab

y axis label.

lty

vector of line types. Default 1:nc (nc is the number of curves in x). For color displays, lty=1, color=1:nc, might be more appropriate. If length(lty)<nc, then lty[1] is used for all.

xscale

Scale of the X axis. Default is in days (1).

col

vector of colors. If length(col)<nc, then the col[1] is used for all.

lwd

vector of line widths. If length(lwd)<nc, then lwd[1] is used for all.

curves

Vector if integers, specifies which curves should be plotted. May take values 1:nc, where nc is the number of curves in x. By default, all of the curves are plotted.

conf.int

Vector if integers, specifies which confidence intervals should be plotted. May take values 1:nc, where nc is the number of curves in x. By default, no confidence intervals are plotted.

all.times

By default, the disease specific mortality estimate is plotted as a step function between event or censoring times. If set to TRUE, the graph is evaluated at all estimated times.

...

additional arguments passed to the initial call of the plot function.

Value

No value is returned.

Details

By default, the graph is plotted as a step function for the cause specific mortality and as a piecewise linear function for the population mortality. It is evaluated at all event and censoring times even though it constantly changes also between these time points.

If the argument all.times is set to TRUE, the plot is evaluated at all times that were used for numerical integration in the cmp.rel function (there, the default is set to daily intervals). If only specific time points are to be added, this should be done via argument add.times in cmp.rel.

See Also

rs.surv

Examples

Run this code
# NOT RUN {
data(slopop)
data(rdata)
fit <- cmp.rel(Surv(time,cens)~sex,rmap=list(age=age*365.241),
		ratetable=slopop,data=rdata,tau=3652.41)
plot(fit,col=c(1,1,2,2),xscale=365.241,conf.int=c(1,3))
# }

Run the code above in your browser using DataCamp Workspace