kmplot {maicplus} | R Documentation |
Kaplan Meier (KM) plot function for anchored and unanchored cases
Description
It is wrapper function of basic_kmplot
. The argument setting is similar to maic_anchored
and
maic_unanchored
, and it is used in those two functions.
Usage
kmplot(
weights_object,
tte_ipd,
tte_pseudo_ipd,
trt_ipd,
trt_agd,
trt_common = NULL,
normalize_weights = FALSE,
trt_var_ipd = "ARM",
trt_var_agd = "ARM",
km_conf_type = "log-log",
km_layout = c("all", "by_trial", "by_arm"),
...
)
Arguments
weights_object |
an object returned by |
tte_ipd |
a data frame of individual patient data (IPD) of internal trial, contain at least |
tte_pseudo_ipd |
a data frame of pseudo IPD by digitized KM curves of external trial (for time-to-event
endpoint), contain at least |
trt_ipd |
a string, name of the interested investigation arm in internal trial |
trt_agd |
a string, name of the interested investigation arm in external trial |
trt_common |
a string, name of the common comparator in internal and external trial, by default is NULL, indicating unanchored case |
normalize_weights |
logical, default is |
trt_var_ipd |
a string, column name in |
trt_var_agd |
a string, column name in |
km_conf_type |
a string, pass to |
km_layout |
a string, only applicable for unanchored case ( |
... |
other arguments in |
Value
In unanchored case, a KM plot with risk set table. In anchored case, depending on km_layout
,
if "by_trial", 2 by 1 plot, first all KM curves (incl. weighted) in IPD trial, and then KM curves in AgD trial, with risk set table.
if "by_arm", 2 by 1 plot, first KM curves of
trt_agd
andtrt_ipd
(with and without weights), and then KM curves oftrt_common
in AgD trial and IPD trial (with and without weights). Risk set table is appended.if "all", 2 by 2 plot, all plots in "by_trial" and "by_arm" without risk set table appended.
Examples
# unanchored example using kmplot
data(weighted_sat)
data(adtte_sat)
data(pseudo_ipd_sat)
kmplot(
weights_object = weighted_sat,
tte_ipd = adtte_sat,
tte_pseudo_ipd = pseudo_ipd_sat,
trt_var_ipd = "ARM",
trt_var_agd = "ARM",
endpoint_name = "Overall Survival",
trt_ipd = "A",
trt_agd = "B",
trt_common = NULL,
km_conf_type = "log-log",
time_scale = "month",
time_grid = seq(0, 20, by = 2),
use_colors = NULL,
use_line_types = NULL,
use_pch_cex = 0.65,
use_pch_alpha = 100
)
# anchored example using kmplot
data(weighted_twt)
data(adtte_twt)
data(pseudo_ipd_twt)
# plot by trial
kmplot(
weights_object = weighted_twt,
tte_ipd = adtte_twt,
tte_pseudo_ipd = pseudo_ipd_twt,
trt_ipd = "A",
trt_agd = "B",
trt_common = "C",
trt_var_ipd = "ARM",
trt_var_agd = "ARM",
endpoint_name = "Overall Survival",
km_conf_type = "log-log",
km_layout = "by_trial",
time_scale = "month",
time_grid = seq(0, 20, by = 2),
use_colors = NULL,
use_line_types = NULL,
use_pch_cex = 0.65,
use_pch_alpha = 100
)
# plot by arm
kmplot(
weights_object = weighted_twt,
tte_ipd = adtte_twt,
tte_pseudo_ipd = pseudo_ipd_twt,
trt_ipd = "A",
trt_agd = "B",
trt_common = "C",
trt_var_ipd = "ARM",
trt_var_agd = "ARM",
endpoint_name = "Overall Survival",
km_conf_type = "log-log",
km_layout = "by_arm",
time_scale = "month",
time_grid = seq(0, 20, by = 2),
use_colors = NULL,
use_line_types = NULL,
use_pch_cex = 0.65,
use_pch_alpha = 100
)
# plot all
kmplot(
weights_object = weighted_twt,
tte_ipd = adtte_twt,
tte_pseudo_ipd = pseudo_ipd_twt,
trt_ipd = "A",
trt_agd = "B",
trt_common = "C",
trt_var_ipd = "ARM",
trt_var_agd = "ARM",
endpoint_name = "Overall Survival",
km_conf_type = "log-log",
km_layout = "all",
time_scale = "month",
time_grid = seq(0, 20, by = 2),
use_colors = NULL,
use_line_types = NULL,
use_pch_cex = 0.65,
use_pch_alpha = 100
)