plot.hare: Hare: hazard regression

View source: R/polspline.R

plot.hareR Documentation

Hare: hazard regression

Description

Plots a density, distribution function, hazard function or survival function for a hare object.

Usage

## S3 method for class 'hare'
plot(x, cov, n = 100, which = 0, what = "d", time, add = FALSE, xlim,
xlab, ylab, type, ...) 

Arguments

x

hare object, typically the result of hare.

cov

a vector of length fit\$ncov, indicating for which combination of covariates the plot should be made. Can be omitted only if fit\$ncov is 0.

n

the number of equally spaced points at which to plot the function.

which

for which coordinate should the plot be made. 0: time; positive value i: covariate i. Note that if which is the positive value i, then the element corresponding to this covariate must be given in cov even though its actual value is irrelevant.

what

what should be plotted: "d" (density), "p" (distribution function), "s" (survival function) or "h" (hazard function).

time

if which is not equal to 0, the value of time for which the plot should be made.

add

should the plot be added to an existing plot?

xlim

plotting limits; default is from the maximum of 0 and 10% before the 1st percentile to the minimmum of 10% further than the 99th percentile and the largest observation.

xlab, ylab

labels for the axes. Per default no labels are printed.

type

plotting type. The default is lines.

...

all other plotting options are passed on.

Details

This function produces a plot of a hare fit at n equally spaced points roughly covering the support of the density. (Use xlim=c(from,to) to change the range of these points.)

Author(s)

Charles Kooperberg clk@fredhutch.org.

References

Charles Kooperberg, Charles J. Stone and Young K. Truong (1995). Hazard regression. Journal of the American Statistical Association, 90, 78-94.

Charles J. Stone, Mark Hansen, Charles Kooperberg, and Young K. Truong. The use of polynomial splines and their tensor products in extended linear modeling (with discussion) (1997). Annals of Statistics, 25, 1371–1470.

See Also

hare, summary.hare, dhare, hhare, phare, qhare, rhare.

Examples

fit <- hare(testhare[,1], testhare[,2], testhare[,3:8])       
# hazard curve for covariates like case 1 
plot(fit, testhare[1,3:8], what = "h") 
# survival function as a function of covariate 2, for covariates as case 1 at t=3 
plot(fit, testhare[1,3:8], which = 2, what = "s",  time = 3)  

polspline documentation built on May 29, 2024, 3:38 a.m.