plot.TPmsm: plot method for a TPmsm object

View source: R/plot.TPmsm.R

plot.TPmsmR Documentation

plot method for a TPmsm object

Description

plot method for an object of class ‘TPmsm’. It draws the estimated transition probabilities in a basic scatterplot.

Usage

## S3 method for class 'TPmsm'
plot(x, tr.choice, xlab = "Time", ylab="Transition probability",
col, lty, xlim, ylim, conf.int=FALSE, ci.col, ci.lty,
legend=TRUE, legend.pos, curvlab, legend.bty="n", ...)

Arguments

x

An object of class ‘TPmsm’.

tr.choice

Character vector of the form ‘c(“from to”, “from to”)’ specifying which transitions should be plotted. Default, all the transition probabilities are plotted.

xlab

x-axis label. Default is “Time”.

ylab

y-axis label. Default is “Transition probability”.

col

Vector of colour. Default is black.

lty

Vector of line type. Default is 1:number of transitions.

xlim

Limits of x-axis for the plot.

ylim

Limits of y-axis for the plot.

conf.int

Logical. Whether to display pointwise confidence bands. Default is FALSE.

ci.col

Colour of the confidence bands. Default is col.

ci.lty

Line type of the confidence bands. Default is 3.

legend

A logical specifying if a legend should be added.

legend.pos

A vector giving the legend's position. See legend for further details.

curvlab

A character or expression vector to appear in the legend. Default is the name of the transitions.

legend.bty

Box type for the legend. By default no box is drawn.

...

Further arguments for plot.

Value

No value is returned.

Author(s)

Artur Araújo, Javier Roca-Pardiñas and Luís Meira-Machado

References

Araújo A, Meira-Machado L, Roca-Pardiñas J (2014). TPmsm: Estimation of the Transition Probabilities in 3-State Models. Journal of Statistical Software, 62(4), 1-29. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v062.i04")}

See Also

legend, plot.default.

Examples

# Set the number of threads
nth <- setThreadsTP(2);

# Create survTP object
data(bladderTP);
bladderTP_obj <- with( bladderTP, survTP(time1, event1, Stime, event) );

# Compute KMW transition probabilities with confidence band
TPmsm_obj <- transKMW(object=bladderTP_obj, s=5, t=59, conf=TRUE, conf.level=0.95,
method.boot="basic", method.est=2);

# Plot all the transitions without confidence band
plot(TPmsm_obj, conf.int=FALSE, col=seq_len(5), lty=1);

# Plot all the transitions with confidence band
tr.choice <- colnames(TPmsm_obj$est);
par.orig <- par( c("mfrow", "cex") );
par( mfrow=c(2,3) );
for ( i in seq_len( length(tr.choice) ) ) {
	plot(TPmsm_obj, tr.choice=tr.choice[i], conf.int=TRUE, legend=FALSE, main=tr.choice[i],
	xlab="", ylab="");
}
par(mfrow=c(1, 1), cex=1.2);
title(xlab="Time", ylab="Transition probability", line=3);
par(par.orig);

# Restore the number of threads
setThreadsTP(nth);

TPmsm documentation built on May 29, 2024, 10:43 a.m.