plot.reReg | R Documentation |
Plot the baseline cumulative rate function and the baseline cumulative hazard function
(if applicable) for an reReg
object.
## S3 method for class 'reReg'
plot(
x,
baseline = c("both", "rate", "hazard"),
smooth = FALSE,
newdata = NULL,
frailty = NULL,
showName = FALSE,
control = list(),
...
)
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. |
The argument control
consists of options with argument defaults to a list
with the following values:
customizable x-label, default value is "Time".
customizable y-label, default value is empty.
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"
.
A ggplot
object.
reReg
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.