lines.TPmsm: lines method for a TPmsm object

Description Usage Arguments Value Author(s) See Also Examples

View source: R/lines.TPmsm.R

Description

lines method for an object of class ‘TPmsm’.

Usage

1
2
3
## S3 method for class 'TPmsm'
lines(x, tr.choice, col, lty, conf.int=FALSE, ci.col, ci.lty,
legend=FALSE, 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.

col

Vector of colour. Default is black.

lty

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

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

Value

No value is returned.

Author(s)

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

See Also

legend, lines, plot.default, plot.TPmsm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Set the number of threads
nth <- setThreadsTP(2)

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

# Compute transition probabilities without confidence band
KMW <- transKMW(object=bladderTP_obj, s=5, t=59, conf=FALSE, method.est=1)
KMPW <- transKMPW(object=bladderTP_obj, s=5, t=59, conf=FALSE, method.est=1)
AJ <- transAJ(object=bladderTP_obj, s=5, t=59, conf=FALSE)
PAJ <- transPAJ(object=bladderTP_obj, s=5, t=59, conf=FALSE)
LIN <- transLIN(object=bladderTP_obj, s=5, t=59, conf=FALSE)
LS <- transLS(object=bladderTP_obj, s=5, t=59, h=c(0.25, 2.5),
nh=25, ncv=50, conf=FALSE)

# Plot '1 2' KMW transition probability estimate
par( mfrow=c(1, 1) )
plot(KMW, tr.choice="1 2", ylab="P12(5, Time)", xlab="Time",
col=1, lty=1, legend=FALSE)

# Add other '1 2' transition probability estimates
lines(KMPW, tr.choice="1 2", col=2, lty=1)
lines(AJ, tr.choice="1 2", col=3, lty=1)
lines(PAJ, tr.choice="1 2", col=4, lty=1)
lines(LIN, tr.choice="1 2", col=5, lty=1)
lines(LS, tr.choice="1 2", col=6, lty=1)

# Add legend
legend(x="topleft", legend=c("KMW", "KMPW", "AJ", "PAJ", "LIN", "LS"),
col=1:6, lty=1, bty="n")

# Plot all the transitions
tr.choice <- colnames(KMW$est)
par.orig <- par( c("mfrow", "cex") )
par( mfrow=c(2, 3) )
for ( i in seq_len( length(tr.choice) ) ) {
	plot(KMW, tr.choice=tr.choice[i], col=1, lty=1, legend=FALSE,
	main=tr.choice[i], xlab="", ylab="")
	lines(KMPW, tr.choice=tr.choice[i], col=2, lty=1)
	lines(AJ, tr.choice=tr.choice[i], col=3, lty=1)
	lines(PAJ, tr.choice=tr.choice[i], col=4, lty=1)
	lines(LIN, tr.choice=tr.choice[i], col=5, lty=1)
	lines(LS, tr.choice=tr.choice[i], col=6, lty=1)
}
plot.new()
legend(x="center", legend=c("KMW", "KMPW", "AJ", "PAJ", "LIN", "LS"),
col=1:6, lty=1, bty="n", cex=1.5)
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 Aug. 5, 2019, 1:02 a.m.