plot.npsurv: Plot Functions for Nonparametric Survival Estimation

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/npsurv.R

Description

Functions for plotting nonparametric survival functions and related ones.

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'npsurv'
plot(x, ...)
## S3 method for class 'idf'
plot(x, data, fn=c("surv","grad"), ...)
plotsurvidf(f, style=c("box","uniform","left","right","midpoint"),
           xlab="Time", ylab="Survival Probability", col="blue3", fill=0,  
           add=FALSE, lty=1, lty.inf=2, xlim, ...)
plotgradidf(f, data, w=1, col1="red3", col2="blue3", 
           xlab="Survival Time", ylab="Gradient", xlim, ...)

Arguments

x

an object of class npsurv (i.e., an output of function npsurv) or an object of class idf.

...

arguments for other graphical parameters (see par).

fn

either "surv" or "grad", to indicate plotting either the survival or the gradient function.

f

an object of class idf.

style

for how to plot the survival function on a "maximal intersection interval":

= box, plot a rectangle, which shows the uncertainty of probability allocation within the interval;

= uniform, treat it as a uniform distribution and hence the diagonal line of the rectangle is plotted;

= left, plot only the left side of the rectangle;

= right, plot only the right side of the rectangle;

= midpoint, plot a vertical line at the midpoint of the interval.

xlab, ylab

x- or y-axis label.

add

= TRUE, adds the curve to the existing plot;

= FALSE, plots the curve in a new one.

col

color for all line segments, including box/rectangle borders.

fill

color for filling a box/rectangle. By default, a lighter semi-transparent color is used.

lty

line type

lty.inf

line type for the rectangle that may extend to infinity.

data

vector or matrix that stores observations, or an object of class icendata.

w

additional weights/multiplicities of the observations stored in x.

col1

color for drawing maximal intersection intervals allocated with positive probabilities.

col2

color for drawing all gradients and the maximal intersection intervals allocated with zero probabilities.

xlim

x-coordinate limit points.

Details

plot.npsurv and plot.idf are wrapper functions that call either plotsurvidf or plotgradidf.

plotsurvidf plots the survival function of the nonparametric maximum likelihood estimate (NPMLE).

plotgradidf plots the gradient function of the NPMLE.

plotsurvidf by default chooses a less saturated color for fill than col.

plotgradidf plots gradient values as vertical lines located as the left endpoints of the maximal intersection intervals. Each maximal intersection interval is plotted as a wider line on the horizontal zero-gradient line, with a circle to represent the open left endpoint of the interval and a solid point the closed right endpoint of the interval. The maximal intersection intervals allocated with positive probabilities have zero gradients, and hence no vertical lines are drawn for them.

Author(s)

Yong Wang <yongwang@auckland.ac.nz>

References

Wang, Y. (2008). Dimension-reduced nonparametric maximum likelihood computation for interval-censored data. Computational Statistics & Data Analysis, 52, 2388-2402.

See Also

icendata, idf, npsurv.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(ap)
plot(r<-npsurv(ap))              # survival function
plot(r$f, ap, fn="g")            # all gradients virtually zeros.

data(cancer)
cancerRT = with(cancer, cancer[group=="RT",1:2])
plot(rt<-npsurv(cancerRT), xlim=c(0,60))                  # survival of RT 
cancerRCT = with(cancer, cancer[group=="RCT",1:2])
plot(rct<-npsurv(cancerRCT), add=TRUE, col="green3") # survival of RCT 
## as uniform dististrbutions.
plot(rt, add=TRUE, style="uniform", col="blue3")
plot(rct, add=TRUE, style="uniform", col="green3")

## plot gradients; must supply data
plot(rt, cancerRT, fn="g")        # for group RT
plotgradidf(rct$f, cancerRCT)   # or, for group RCT

npsurv documentation built on Oct. 23, 2020, 5:43 p.m.

Related to plot.npsurv in npsurv...