plot.resMexhaz: Plot method for a resMexhaz object

View source: R/plot.resMexhaz.R

plot.resMexhazR Documentation

Plot method for a resMexhaz object

Description

Function for plotting various quantities calculated from a mexhaz model.

Usage

## S3 method for class 'resMexhaz'
plot(x, conf.int = TRUE, lty.pe = "solid", lty.ci =
"blank", col.ci = "blue", alpha.col.ci = 0.25, ylim = NULL, ...)

Arguments

x

an object of class resMexhaz, corresponding to various predictions based on a survival model fitted with the mexhaz function. Predictions can be obtained for multiple times for one vector of covariables ("multitime") or for several vectors of covariables at one time point ("multiobs"). The plot() function only applies to the "multitime" type of predictions.

conf.int

logical value allowing the user to decide whether to plot the confidence limits of the survival (or hazard).

lty.pe

type of line used for drawing the hazard/survival estimate.

lty.ci

type of line used for drawing the confidence limits.

col.ci

color used to fill in the polygon defined by the confidence limits.

alpha.col.ci

parameter used internally by the rgb() function to set the color transparency.

ylim

when set to NULL (default value), the range of the y-axis is based on the range of the confidence limits of the quantity to be plotted.

...

additional parameters that are directly passed to the plot function. These parameters will apply simultaneously to the point estimate and confidence limit curves.

See Also

adjsurv, riskfunc, lines.resMexhaz

Examples


data(simdatn1)

## Fit of a fixed-effect hazard model, with the baseline hazard
## described by a linear B-spline with two knots at 1 and 5 year and with
## effects of age (agecr), deprivation index (depindex) and sex (IsexH)

Mod_bs2 <- mexhaz(formula=Surv(time=timesurv,
event=vstat)~agecr+depindex+IsexH, data=simdatn1, base="exp.bs",
degree=2, knots=c(1,5), verbose=0)

## Relative risk (ratio of cumulative incidence curves) for men versus
## women

RR_Modbs2 <- riskfunc(Mod_bs2, time.pts=seq(0,10, by=0.1),
data=data.frame(agecr=0.1, IsexH=1, depindex=0),
data.0=data.frame(agecr=0.1, IsexH=0, depindex=0), conf.int="delta",
type="rr")

plot(RR_Modbs2)
abline(h=1, lty="dashed")


mexhaz documentation built on Oct. 31, 2022, 5:08 p.m.