Learn R Programming

reReg (version 1.2.1)

plot.reReg: Plot the Baseline Cumulative Rate Function and the Baseline Cumulative Hazard Function

Description

Plot the baseline cumulative rate function and the baseline cumulative hazard function (if applicable) for an reReg object. The 95% confidence intervals on the baseline cumulative rate function and the baseline cumulative hazard function are provided when the reReg object is fitted with standard error estimation.

Usage

# S3 method for reReg
plot(x, baseline = c("both", "rate", "hazard"),
  smooth = FALSE, control = list(), ...)

Arguments

x

an object of class reReg, returned by the reReg function.

baseline

a character string specifying which baseline function to plot.

baseline = "both"

plot both the baseline cumulative rate and the baseline cumulative hazard function in separate panels within the same display (default).

baseline = "rate"

plot the baseline cumulative rate function.

baseline = "hazard"

plot the baseline cumulative hazard function.

smooth

an optional logical value indicating whether to add a smooth curve obtained from a monotone increasing P-splines implemented in package scam.

control

a list of control parameters. See Details.

...

graphical parameters to be passed to methods. These include xlab, ylab, main, and more. See Details.

Value

A ggplot object.

Details

The argument control consists of options with argument defaults to a list with the following values:

xlab

customizable x-label, default value is "Time".

ylab

customizable y-label, default value is empty.

main

customizable title, default value are "Baseline cumulative rate and hazard function" when baseline = "both", "Baseline cumulative rate function" when baseline = "rate", and "Baseline cumulative hazard function" when baseline = "hazard".

See Also

reReg

Examples

Run this code
# NOT RUN {
data(simDat)
fm <- Recur(Time, id, event, status) ~ x1 + x2

fit <- reReg(fm, data = simDat, method = "cox.HW")
plot(fit)
plot(fit, baseline = "rate")
plot(fit, baseline = "rate", xlab = "Time (days)")
plot(fit, baseline = "rate", smooth = TRUE)

# }

Run the code above in your browser using DataLab