This is a wrapper function to provide adjusted effect estimates and relevant statistics in anchored case (i.e. there is a common comparator arm in the internal and external trial).
Usage
maic_anchored(
weights_object,
ipd,
pseudo_ipd,
trt_ipd,
trt_agd,
trt_common,
trt_var_ipd = "ARM",
trt_var_agd = "ARM",
normalize_weights = FALSE,
endpoint_type = "tte",
endpoint_name = "Time to Event Endpoint",
eff_measure = c("HR", "OR", "RR", "RD"),
boot_ci_type = c("norm", "basic", "stud", "perc", "bca"),
time_scale = "months",
km_conf_type = "log-log",
binary_robust_cov_type = "HC3"
)
Arguments
- weights_object
an object returned by
estimate_weight
- ipd
a data frame that meet format requirements in 'Details', individual patient data (IPD) of internal trial
- pseudo_ipd
a data frame, pseudo IPD from digitized KM curve of external trial (for time-to-event endpoint) or from contingency table (for binary endpoint)
- trt_ipd
a string, name of the interested investigation arm in internal trial
ipd
(internal IPD)- trt_agd
a string, name of the interested investigation arm in external trial
pseudo_ipd
(pseudo IPD)- trt_common
a string, name of the common comparator in internal and external trial
- trt_var_ipd
a string, column name in
ipd
that contains the treatment assignment- trt_var_agd
a string, column name in
ipd
that contains the treatment assignment- normalize_weights
logical, default is
FALSE
. IfTRUE
,scaled_weights
(normalized weights) inweights_object$data
will be used.- endpoint_type
a string, one out of the following "binary", "tte" (time to event)
- endpoint_name
a string, name of time to event endpoint, to be show in the last line of title
- eff_measure
a string, "RD" (risk difference), "OR" (odds ratio), "RR" (relative risk) for a binary endpoint; "HR" for a time-to-event endpoint. By default is
NULL
, "OR" is used for binary case, otherwise "HR" is used.- boot_ci_type
a string, one of
c("norm","basic", "stud", "perc", "bca")
to select the type of bootstrap confidence interval. See boot::boot.ci for more details.- time_scale
a string, time unit of median survival time, taking a value of 'years', 'months', 'weeks' or 'days'. NOTE: it is assumed that values in TIME column of
ipd
andpseudo_ipd
is in the unit of days- km_conf_type
a string, pass to
conf.type
ofsurvfit
- binary_robust_cov_type
a string to pass to argument
type
of sandwich::vcovHC, see possible options in the documentation of that function. Default is"HC3"
Details
It is required that input ipd
and pseudo_ipd
to have the following
columns. This function is not sensitive to upper or lower case of letters in column names.
USUBJID - character, unique subject ID
ARM - character or factor, treatment indicator, column name does not have to be 'ARM'. User specify in
trt_var_ipd
andtrt_var_agd
For time-to-event analysis, the follow columns are required:
EVENT - numeric,
1
for censored/death,0
otherwiseTIME - numeric column, observation time of the
EVENT
; unit in days
For binary outcomes:
RESPONSE - numeric,
1
for event occurred,0
otherwise
Examples
# Anchored example using maic_anchored for time-to-event data
data(weighted_twt)
data(adtte_twt)
data(pseudo_ipd_twt)
result_tte <- maic_anchored(
weights_object = weighted_twt,
ipd = adtte_twt,
pseudo_ipd = pseudo_ipd_twt,
trt_var_ipd = "ARM",
trt_var_agd = "ARM",
trt_ipd = "A",
trt_agd = "B",
trt_common = "C",
endpoint_name = "Overall Survival",
endpoint_type = "tte",
eff_measure = "HR",
time_scale = "month",
km_conf_type = "log-log",
)
result_tte$descriptive$summary
#> trt_ind treatment type records n.max n.start events
#> 1 C C IPD, before matching 500 500.0000 500.0000 500.0000
#> 2 A A IPD, before matching 500 500.0000 500.0000 190.0000
#> 3 C C IPD, after matching 500 173.4208 173.4208 173.4208
#> 4 A A IPD, after matching 500 173.4208 173.4208 55.5418
#> 5 C C AgD, external 500 500.0000 500.0000 500.0000
#> 6 B B AgD, external 300 300.0000 300.0000 178.0000
#> events% rmean se(rmean) median 0.95LCL 0.95UCL
#> 1 100.00000 2.564797 0.11366994 1.836467 1.644765 2.045808
#> 2 38.00000 8.709690 0.35514766 7.587627 6.278691 10.288538
#> 3 100.00000 2.690665 0.20750373 1.818345 1.457222 2.352181
#> 4 32.02718 10.575301 0.57325902 12.166430 10.244293 NA
#> 5 100.00000 2.455272 0.09848888 1.851987 1.670540 2.009650
#> 6 59.33333 4.303551 0.33672602 2.746131 2.261125 3.320857
result_tte$inferential$summary
#> case HR LCL UCL pval
#> 1 AC 0.2216588 0.1867151 0.2631423 2.136650e-66
#> 2 adjusted_AC 0.1639632 0.1120463 0.2399358 1.302433e-20
#> 3 BC 0.5718004 0.4811989 0.6794607 2.143660e-10
#> 4 AB 0.3876507 0.3039348 0.4944253 2.270430e-14
#> 5 adjusted_AB 0.2867489 0.1887868 0.4355439 4.704496e-09
# Anchored example using maic_anchored for binary outcome
data(weighted_twt)
data(adrs_twt)
# Reported summary data
pseudo_adrs <- get_pseudo_ipd_binary(
binary_agd = data.frame(
ARM = c("B", "C", "B", "C"),
RESPONSE = c("YES", "YES", "NO", "NO"),
COUNT = c(280, 120, 200, 200)
),
format = "stacked"
)
# inferential result
result_binary <- maic_anchored(
weights_object = weighted_twt,
ipd = adrs_twt,
pseudo_ipd = pseudo_adrs,
trt_var_ipd = "ARM",
trt_var_agd = "ARM",
trt_ipd = "A",
trt_agd = "B",
trt_common = "C",
endpoint_name = "Binary Event",
endpoint_type = "binary",
eff_measure = "OR"
)
result_binary$descriptive$summary
#> trt_ind treatment type n events events_pct
#> 1 C C IPD, before matching 500 338.0000 67.60000
#> 2 A A IPD, before matching 500 390.0000 78.00000
#> 3 C C IPD, after matching 500 124.2146 24.84292
#> 4 A A IPD, after matching 500 128.7925 25.75849
#> 5 C C AgD, external 320 120.0000 37.50000
#> 6 B B AgD, external 480 280.0000 58.33333
result_binary$inferential$summary
#> case OR LCL UCL pval
#> 1 AC 1.6993007 1.2809976 2.2541985 2.354448e-04
#> 2 adjusted_AC 1.1432118 0.6694678 1.9521971 6.239765e-01
#> 3 BC 2.3333333 1.7458092 3.1185794 1.035032e-08
#> 4 AB 0.7282717 0.4857575 1.0918611 1.248769e-01
#> 5 adjusted_AB 0.4899479 0.2665649 0.9005273 2.159935e-02