Plot Method for Weighted Kaplan-Meier Estimates
# S3 method for weightedKM
plot(
x,
type = "Kaplan-Meier",
include_CI = TRUE,
conf_type = "log-log",
conf_level = 0.95,
max_time = NULL,
strata_to_plot = NULL,
strata_colors = NULL,
curve_width = 1,
CI_alpha = 0.3,
legend_position = "right",
legend_title = NULL,
plot_title = NULL,
xlab = "Time",
ylab = NULL,
xlim = NULL,
ylim = NULL,
risk_table = FALSE,
risk_table_stats = c("n.risk", "n.acc.event"),
risk_table_height = 0.25,
risk_table_breaks = NULL,
risk_table_fontsize = 3.5,
...
)A ggplot2 object if risk_table = FALSE, or a combined plot
(cowplot object) if risk_table = TRUE.
An object of class "weightedKM" from weightedKM().
Type of curve to plot: "Kaplan-Meier" (survival probabilities, default) or "CR" (cumulative risk, aka. cumulative incidence = 1 - survival).
Logical. Include confidence interval ribbons? Default TRUE.
Type of confidence interval: "plain", "log", or "log-log" (default). See Details.
Confidence level for intervals. Default 0.95.
Maximum time to display on x-axis. Default is maximum observed event time.
Character vector of treatment levels to plot. Default plots all groups.
Character vector of colors for each stratum in
strata_to_plot. Must match length. Default uses ggplot2 colors.
Line width for survival curves. Default 1.
Transparency level for confidence interval ribbons (0-1). Default 0.3.
Position of legend: "right" or "bottom". Default "right".
Title for legend. Default "Treatment".
Main plot title. Default depends on type.
X-axis label. Default "Time".
Y-axis label. Default depends on type.
Numeric vector of length 2 specifying x-axis limits. Default c(0, max_time).
Numeric vector of length 2 specifying y-axis limits. Default c(0, 1).
Logical. Add risk table below the plot? Default FALSE.
Requires cowplot package if TRUE.
Character vector specifying statistics to display in risk table.
Options: "n.risk" (number at risk), "n.acc.event" (cumulative events).
Default c("n.risk", "n.acc.event").
Numeric. Relative height of risk table (0-1). Default 0.25.
Numeric vector of time points for risk table columns.
If NULL (default), automatically determined based on max_time.
Numeric. Font size for risk table text. Default 3.5.
Additional arguments (currently unused).
When type = "CR", the function plots \(1 - S(t)\) representing the
probability of experiencing the event by time t. Variance is the same as
for survival, but confidence intervals are calculated on the CR scale.