plot.reReg {reReg} | R Documentation |
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.
Usage
## S3 method for class 'reReg'
plot(
x,
baseline = c("both", "rate", "hazard"),
smooth = FALSE,
newdata = NULL,
frailty = NULL,
showName = FALSE,
control = list(),
...
)
Arguments
x |
an object of class |
baseline |
a character string specifying which baseline function to plot.
|
smooth |
an optional logical value indicating whether to add a smooth curve
obtained from a monotone increasing P-splines implemented in package |
newdata |
an optional data frame contains variables to include in the calculation of the cumulative rate function. If omitted, the baseline rate function will be plotted. |
frailty |
an optional vector to specify the shared frailty for |
showName |
an optional logical value indicating whether to label the curves
when |
control |
a list of control parameters. See Details. |
... |
additional graphical parameters to be passed to methods. |
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" whenbaseline = "rate"
, and "Baseline cumulative hazard function" whenbaseline = "hazard"
.
Value
A ggplot
object.
See Also
Examples
data(simDat)
fm <- Recur(t.start %to% t.stop, id, event, status) ~ x1 + x2
fit <- reReg(fm, data = simDat, B = 0)
plot(fit)
plot(fit, xlab = "Time (days)", smooth = TRUE)
## Predicted cumulative rate and hazard given covariates
newdata <- expand.grid(x1 = 0:1, x2 = mean(simDat$x2))
plot(fit, newdata = newdata, showName = TRUE)