| plot.WA | R Documentation |
Plot while-alive trajectory or a covariate's time-varying effect
## S3 method for class 'WA'
plot(
x,
newdata,
t_seq,
id = 1,
mode = c("wa", "cov"),
covariate = NULL,
ylab_wa = "While-alive loss rate",
ylab_cov = NULL,
xlab = "Time",
level = 0.95,
smooth = FALSE,
span = 0.3,
...
)
x |
A |
newdata |
Data used to rebuild the RHS design (same columns as in the model). |
t_seq |
Times to plot over (numeric vector). |
id |
Row index of |
mode |
|
covariate |
Character; covariate name (must appear on RHS) when |
ylab_wa |
Y-axis label for while-alive plot. |
ylab_cov |
Y-axis label for covariate-effect plot; default
|
xlab |
X-axis label. |
level |
Confidence level for ribbons (default 0.95). |
smooth |
Logical; if |
span |
LOESS span used when |
... |
Unused. |
A ggplot2 object.
ex_dt <- crt_dt[crt_dt$cluster %in% c(1,2,3,4,7,10), ]
fit <- WA_fit(survival::Surv(time, status) ~ trt + Z1 + Z2,
data = ex_dt, id="id", cluster="cluster",
knots=seq(0, max(ex_dt$time), length.out=6),
tau_grid=seq(0, max(ex_dt$time), length.out=6),
basis="bz", degree=1, link="log",
w_recur=c(1,1), w_term=2, ipcw="km")
nd <- unique(ex_dt[, c("trt","Z1","Z2")])
plot(fit, newdata = nd,
t_seq = seq(0, max(fit$tau_grid), length.out = 200),
id = 1, mode = "wa", smooth = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.