comprisk | R Documentation |
Plot and compare cumulative/crude incidence in a competing risk setting
comprisk( time = NULL, status = NULL, strata = NULL, time_unit = c("days", "weeks", "months", "years"), time_by = NULL, plot = TRUE, plot_ci = FALSE, ylab = NULL, xlab = NULL, ylim = c(0L, 1L), xlim = NULL, test = c("gray", "none"), col_status = seq_len(nlevels(status) - 1), col_strata = seq_len(nlevels(strata)), cex_test = par("cex") * 0.8, cex_legend = par("cex") * 0.8, plot_grid = TRUE )
time |
survival time variable |
status |
integer with 0 = censored or factor with first level = censored |
strata |
Stratifying variable (optional) |
time_unit |
Time unit of x axis |
time_by |
Time step x axis (in days) |
plot |
plot (default = TRUE) or only return estimates? |
plot_ci |
plot confidence intervalse for estimates (for univariate unstacked and multivariate plots) |
ylab |
Y-axis label. |
xlab |
X-axis label. If NULL a suitable default based on time_unit will be provided |
ylim |
Y-axis limit. Default to c(0,1) be provided @param |
xlim |
X-axis limit. If NULL a suitable default based on time_unit will be provided |
test |
tests: 'none' = don't plot tests, 'gray' = gray test |
col_status |
color for exit status (mainly for univariate plotting) |
col_strata |
color for group status (mainly for bivariate plotting) |
cex_test |
cex parameter for test string |
cex_legend |
cex parameter for legend string |
plot_grid |
plot grid @param plot_n_at_risk Logical value: |
## Not run: library(lbdatasets) par(mfrow = c(1,2)) res <- comprisk(time = mros$time, status = factor(mros$status, levels = 0:2, labels = c("Censored", "Fractured", "Death")), strata = factor(mros$cutbmd, levels = 1:2, labels = c('LowBMD', 'HighBMD')), time_by = 50, ylim = c(0, 0.25), col_strata = c('red', 'black'), xlab = 'Weeks') ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.