Package 'MAICtools'

Title: Performing Matched-Adjusted Indirect Comparisons (MAIC)
Description: A generalised workflow for Matching-Adjusted Indirect Comparison (MAIC) analysis, which supports both anchored and non-anchored MAIC methods. In MAIC, unbiased trial outcome comparison is achieved by weighting the subject-level outcomes of the intervention trial so that the weighted aggregate measures of prognostic or effect-modifying variables match those of the comparator trial. Measurements supported include time-to-event (e.g., overall survival) and binary (e.g., objective tumor response). The method is described in Signorovitch et al. (2010) <doi:10.2165/11538370-000000000-00000> and Signorovitch et al. (2012) <doi:10.1016/j.jval.2012.05.004>.
Authors: Xiao Qi [aut, cre]
Maintainer: Xiao Qi <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2024-12-11 19:29:41 UTC
Source: CRAN

Help Index


Description of AgD_bl dataset

Description

An example data frame containing aggregate summary data from the comparator study.

Usage

data(AgD_bl)

Format

A data frame with X rows and Y variables:

STUDY

Label of the comparator study, e.g., "Study XX-1".

TRT

Grouping variable, e.g., "active" or "control".

N

Number of subjects in each group.

AGEGR

Baseline characteristics variables for matching.

SEX

Baseline characteristics variables for matching.

ECOG

Baseline characteristics variables for matching.

SMK

Baseline characteristics variables for matching.

METBRAIN

Baseline characteristics variables for matching.

METLIVER

Baseline characteristics variables for matching.

BMI.mean

Baseline characteristics variables for matching.

BMI.sd

Baseline characteristics variables for matching.

DIAG.mean

Baseline characteristics variables for matching.

DIAG.sd

Baseline characteristics variables for matching.

Examples

data(AgD_bl)
  head(AgD_bl)

Description of AgD_eff dataset

Description

An example data frame containing aggregate results data from the comparator study.

Usage

data(AgD_eff)

Format

A data frame with X rows and Y variables:

STUDY

Label of the comparator study, e.g., "Study XX-1".

PARAM

Subsets to be analyzed, e.g., "PFSINV", "OS".

EST

Point estimate of the effect size.

CIL

The lower confidence limit of the point estimate of the effect size.

CIU

The upper confidence limit of the point estimate of the effect size.

Examples

data(AgD_eff)
  head(AgD_eff)

Conduct Anchored Matching-Adjusted Indirect Comparison (MAIC).

Description

The endpoint of interest is either time-to-event (e.g., overall survival) or binary (e.g., objective tumor response). The methods described in this documentation are based on those originally outlined by Signorovitch et al., 2012, and further detailed in the National Institute for Health and Care Excellence (NICE) Decision Support Unit (DSU) Technical Support Document (TSD) 18.

Arguments

ipds_wts

A data frame containing individual patient data from the intervention study, with a column containing the estimated weights (derived using estimate_weights).

intervention.arm

The name of the grouping column in the data frame specified by ipds_wts, e.g., intervention.arm = TRT. The default is TRT.

agds_eff

A data frame containing aggregate efficacy results from the comparator study.

comparator

The name of the study column in the data frame specified by agds_eff, e.g., comparator = STUDY. The default is STUDY.

comparator.study

A character specifying the comparator study, which must be quoted and cannot be empty (e.g., comparator.study = "Study XX-1"). This is the value of the study column in agds_eff set by the comparator parameter.

ipds.param.var

The name of the column that specifies only a subset of the ipds_wts to be used.

ipds.param

A character specifying the subset of the rows to be used. This is the value of the column set by the ipds.param.var.

agds.param.var

The name of the column that specifies only a specific result of the agds_eff to be used.

agds.param

A character specifying the subset of the rows to be used. This is the value of the column set by the agds.param.var.

agds.estimate

The column name of the point estimate of the effect size.

agds.ci.lower

The column name for the lower confidence limit of the point estimate of the effect size.

agds.ci.upper

The column name for the upper confidence limit of the point estimate of the effect size.

time

The name of the survival or follow-up time column in the ipds_wts.

status

The status indicator, normally 0 = event, 1 = censored. Can be reset using the event parameter.

event

A numeric value that represents the survival status, 0 = event, 1 = censored.

response

The name of the response status column in the ipds_wts.

stralist

A string specifying the stratification factors in a stratified analysis, e.g., stralist = "BPDL1, CNSBRAIN, AGEGR".

dtype

Two options are available: "HR" and "OR". The default is "HR".

wt.col

The name of the estimated weights column in the data frame specified by ipds_wts. The default is wt.

CIw

The numeric value specifying the width of the confidence interval, with a default of 0.95.

digits

Specify the number of decimal places for the output results.

Value

A data frame containing the anchored matching-adjusted indirect comparison results.

Examples

results1 <- anchored_maic(
  ipds_wts = pts, intervention.arm = TRT,
  agds_eff = AgD_eff, comparator = STUDY,
  comparator.study = "Study XX-1",
  ipds.param.var = PARAMCD, ipds.param = "OS",
  agds.param.var = PARAM, agds.param = "OS",
  agds.estimate = EST, agds.ci.lower = CIL, agds.ci.upper = CIU,
  time = AVAL, status = CNSR, event = 0,
  stralist = "BPDL1, CNSBRAIN, AGEGR", dtype = "HR",
  wt.col = wt, CIw = 0.95, digits = 2)

results1

results2 <- anchored_maic(
  ipds_wts = pts, intervention.arm = TRT,
  agds_eff = AgD_eff, comparator = STUDY,
  comparator.study = "Study XX-1",
  agds.param.var = PARAM, agds.param = "ORR",
  agds.estimate = EST, agds.ci.lower = CIL, agds.ci.upper = CIU,
  response = RESP,
  stralist = "BPDL1, CNSBRAIN, AGEGR", dtype = "OR",
  wt.col = wt, CIw = 0.95, digits = 2)

results2

Check Whether the Variables are Balanced After Weighting

Description

Check Whether the Variables are Balanced After Weighting

Arguments

ipds_wts

A data frame containing individual patient data from the intervention study, with a column containing the estimated weights (derived using estimate_weights).

agds

A data frame containing aggregate summary data from the comparator study.

summary.list

A character list with two elements giving the names of variables for summarizing: the first is a vector of binary variables, and the second is a vector of continuous variables. The variable names must match the column names in ipds and do not need to be the same as those in matching.list. Use c() if a type is absent.

matching.list

A character list with two elements giving the names of variables for matching: the first is a vector of binary variables, and the second is a vector of continuous variables. The variable names must match the column names in ipds and agds. Use c() if a type is absent.

intervention.arm

The name of the grouping column in the data frame specified by ipds, e.g., intervention.arm = TRT. The default is TRT.

comparator

The name of the study column in the data frame specified by agds, e.g., comparator = STUDY. The default is STUDY.

comparator.study

A character specifying the comparator study, which must be quoted and cannot be empty (e.g., comparator.study = "Study XX-1"). This is the value of the study column in agds set by the comparator parameter.

comparator.arm

The name of the grouping column in the data frame specified by agds, e.g., comparator.arm = TRT. The default is TRT.

comparator.n

The name of the subjects number column in the data frame specified by agds, e.g., comparator.n = N. The default is N.

wt.col

The name of the estimated weights column in the data frame specified by ipds_wts. The default is wt.

Value

A data frame containing all specified variables summarised before and after weighting.

Examples

cov <- list(
  binary = c("ECOG", "SMK", "METBRAIN"),
  continuous = c("BMI", "DIAG")
)

cov_all <- list(
  binary = c("SEX", "ECOG", "SMK", "METBRAIN", "METLIVER"),
  continuous = c("BMI", "DIAG", "WEIGHT", "HEIGHT")
)

baseline <- check_matching(
  ipds_wts = pts, agds = AgD_bl,
  summary.list = cov_all, matching.list = cov,
  intervention.arm = TRT,
  comparator = STUDY, comparator.study = "Study XX-1",
  comparator.n = N, comparator.arm = TRT)

baseline

Convert a Longer Table Generated by check_matching() Into a Wider Table

Description

Convert a Longer Table Generated by check_matching() Into a Wider Table

Arguments

baseline.longer

A data frame containing the summarised results generated by check_matching().

intervention.arm

The name of the grouping column in the data frame specified by ipds, e.g., intervention.arm = TRT. The default is TRT.

digits

Specify the number of decimal places for the output results.

Value

A data frame containing the summarized results in a wider format.

Examples

cov <- list(
  binary = c("ECOG", "SMK", "METBRAIN"),
  continuous = c("BMI", "DIAG")
)

cov_all <- list(
  binary = c("SEX", "ECOG", "SMK", "METBRAIN", "METLIVER"),
  continuous = c("BMI", "DIAG", "WEIGHT", "HEIGHT")
)

baseline <- check_matching(
  ipds_wts = pts, agds = AgD_bl,
  summary.list = cov_all, matching.list = cov,
  intervention.arm = TRT,
  comparator = STUDY, comparator.study = "Study XX-1",
  comparator.n = N, comparator.arm = TRT)

baseline_summary <- check_matching2wider(
  baseline.longer = baseline,
  intervention.arm = TRT)

baseline_summary

Estimate Effective Sample Size (ESS)

Description

Estimate Effective Sample Size (ESS)

Arguments

ipds_wts

A data frame containing individual patient data from the intervention study, with a column containing the estimated weights (derived using estimate_weights).

agds

A data frame containing aggregate summary data from the comparator study.

intervention.arm

The name of the grouping column in the data frame specified by ipds, e.g., intervention.arm = TRT. The default is TRT.

comparator

The name of the study column in the data frame specified by agds, e.g., comparator = STUDY. The default is STUDY.

comparator.study

A character specifying the comparator study, which must be quoted and cannot be empty (e.g., comparator.study = "Study XX-1"). This is the value of the study column in agds set by the comparator parameter.

comparator.arm

The name of the grouping column in the data frame specified by agds, e.g., comparator.arm = TRT. The default is TRT.

comparator.n

A The name of the subjects number column in the data frame specified by agds, e.g., comparator.n = N. The default is N.

wt.col

The name of the estimated weights column in the data frame specified by ipds_wts. The default is wt.

digits

Specify the number of decimal places for the output results.

Value

A data frame containing effective sample size (ESS) after weighting.

Examples

ess <- estimate_ess(
  ipds_wts = pts, agds = AgD_bl,
  intervention.arm = TRT,
  comparator = STUDY, comparator.study = "Study XX-1", comparator.arm = TRT,
  comparator.n = N)
ess

Functions for the Estimation of Propensity Weights

Description

Functions for the Estimation of Propensity Weights

Arguments

ipds

A data frame containing individual patient data from the intervention study, with baseline characteristic variables for matching.

agds

A data frame containing aggregate summary data from the comparator study.

matching.list

A character list with two elements giving the names of variables for matching: the first is a vector of binary variables, and the second is a vector of continuous variables. The variable names must match the column names in ipds and agds. Use c() if a type is absent.

intervention.arm

The name of the grouping column in the data frame specified by ipds, e.g., intervention.arm = TRT. The default is TRT.

comparator

The name of the study column in the data frame specified by agds, e.g., comparator = STUDY. The default is STUDY.

comparator.study

A character specifying the comparator study, which must be quoted and cannot be empty (e.g., comparator.study = "Study XX-1"). This is the value of the study column in agds set by the comparator parameter.

comparator.arm

The name of the grouping column in the data frame specified by agds, e.g., comparator.arm = TRT. The default is TRT.

opt.method

The optim method to be used. The default is "BFGS".

seed

The seed for centralized variable missing value imputation (KNN method).

...

Refer to optim for additional parameters.

Value

A data frame containing individual patient data, calculated weights, and rescaled weights.

Examples

cov <- list(
  c("ECOG", "SMK", "METBRAIN"),
  c("BMI", "DIAG")
)

pts <- estimate_weights(
  ipds = IPD,
  agds = AgD_bl,
  matching.list = cov,
  intervention.arm = TRT,
  comparator = STUDY,
  comparator.study = "Study XX-1",
  comparator.arm = TRT
)

Histograms of Weights and Rescaled Weights Distributions

Description

Histograms of Weights and Rescaled Weights Distributions

Arguments

ipds_wts

A data frame containing individual patient data from the intervention study, with a column containing the estimated weights (derived using estimate_weights).

intervention.arm

The name of the grouping column in the data frame specified by ipds, e.g., intervention.arm = TRT. The default is TRT.

wt.col

The name of the estimated weights column in the data frame specified by ipds_wts. The default is wt.

rswt.col

The name of the estimated rescaled weights column in the data frame specified by ipds_wts. The default is wt_rs.

bin

The number of bins or bars of the histogram.

xstepby

An integer guiding the breaks on the X-axis.

ystepby

An integer guiding the breaks on the Y-axis.

...

Refer to geom_histogram for additional parameters.

Value

Histograms of weights and rescaled weights distributions.

Examples

hist_weights(pts, intervention.arm = TRT, xstepby = 2, ystepby = 50)

Description of IPD dataset

Description

An example data frame containing individual patient data from the intervention study, with baseline characteristic variables for matching.

Usage

data(IPD)

Format

A data frame with X rows and Y variables:

SUBJID

Subject Unique Identifier.

TRT

Grouping variable, e.g., "active" or "control".

BPDL1

Stratification factors for stratified analysis.

CNSBRAIN

Stratification factors for stratified analysis.

AGEGR

Stratification factors for stratified analysis.

WEIGHT

Baseline characteristic variables for matching or summarizing.

HEIGHT

Baseline characteristic variables for matching or summarizing.

BMI

Baseline characteristic variables for matching or summarizing.

DIAG

Baseline characteristic variables for matching or summarizing.

SEX

Baseline characteristic variables for matching or summarizing.

ECOG

Baseline characteristic variables for matching or summarizing.

SMK

Baseline characteristics variables for matching.

METBRAIN

Baseline characteristics variables for matching.

METLIVER

Baseline characteristics variables for matching.

PARAMCD

Subsets to be analyzed, e.g., "PFSINV", "OS".

AVAL

Survival or follow up time.

CNSR

The status indicator, 0 = event, 1 = censored.

RESP

Response status, 1 = responder, 0 = non-responder.

Examples

data(IPD)
  head(IPD)

Description of pseudo dataset

Description

An example data frame containing pseudo patient data from the comparator study

Usage

data(pseudo)

Format

A data frame with X rows and Y variables:

SUBJID

Subject Unique Identifier.

PARAMCD

Subsets to be analyzed, e.g., "PFSINV", "OS".

ARM

Label of the comparator study, = "Comparator".

AVAL

Survival or follow up time.

CNSR

The status indicator, 0 = event, 1 = censored.

wt

Weights, = 1.

Examples

data(pseudo)
  head(pseudo)

Description of pts dataset

Description

An example data frame containing individual patient data and estimated weights.

Usage

data(pts)

Format

A data frame with X rows and Y variables:

SUBJID

Subject Unique Identifier.

TRT

Grouping variable, e.g., "active" or "control".

BPDL1

Stratification factors for stratified analysis.

CNSBRAIN

Stratification factors for stratified analysis.

AGEGR

Stratification factors for stratified analysis.

WEIGHT

Baseline characteristic variables for matching or summarizing.

HEIGHT

Baseline characteristic variables for matching or summarizing.

BMI

Baseline characteristic variables for matching or summarizing.

DIAG

Baseline characteristic variables for matching or summarizing.

SEX

Baseline characteristic variables for matching or summarizing.

ECOG

Baseline characteristic variables for matching or summarizing.

SMK

Baseline characteristics variables for matching.

METBRAIN

Baseline characteristics variables for matching.

METLIVER

Baseline characteristics variables for matching.

PARAMCD

Subsets to be analyzed, e.g., "PFSINV", "OS".

AVAL

Survival or follow up time.

CNSR

The status indicator, 0 = event, 1 = censored.

RESP

Response status, 1 = responder, 0 = non-responder.

wt

Estimated propensity weights.

wt_rs

Estimated rescaled propensity weights.

Examples

data(pts)
  head(pts)

Summarize the Distribution of Weight Values

Description

Summarize the Distribution of Weight Values

Arguments

ipds_wts

A data frame containing individual patient data from the intervention study, with a column containing the estimated weights (derived using estimate_weights).

intervention.arm

The name of the grouping column in the data frame specified by ipds, e.g., intervention.arm = TRT. The default is TRT.

wt.col

The name of the estimated weights column in the data frame specified by ipds_wts. The default is wt.

rswt.col

The name of the estimated rescaled weights column in the data frame specified by ipds_wts. The default is wt_rs.

digits

Specify the number of decimal places for the output results.

Value

A data frame containing a summary table of weights and rescaled weights.

Examples

summarize_weights(ipds_wts = pts, intervention.arm = TRT)

Generate a Kaplan-Meier Plot with Individual Efficacy Data and Pseudo Efficacy Data.

Description

Generate a Kaplan-Meier Plot with Individual Efficacy Data and Pseudo Efficacy Data.

Arguments

unds_wts

A combined data frame containing individual efficacy data from the intervention study and pseudo efficacy data from the comparator study.

unds.arm

The name of the grouping column in the combined data frame specified by unds_wts, e.g., comparator.arm = TRT. The default is TRT.

unds.param.var

The name of the column that specifies only a subset of the rows of the data to be used.

unds.param

A character specifying the subset of the rows to be used. This is the value of the column set by the unds.param.var.

time

The name of the survival or follow up time column in the combined data frame.

status

The status indicator, normally 0 = event, 1 = censored. Can be reseted using the event parameter.

event

A numeric value that represents the survival status, 0 = event, 1 = censored.

wt.col

The name of the estimated weights column in the data frame specified by unds_wts. The default is wt.

km.xlim

A numeric value specifying the right limit of the scale on the X-axis.

xstepby

An integer guiding the breaks on the X-axis.

km.ylim

A numeric value specifying the upper limit of the scale on the Y-axis.

ystepby

An integer guiding the breaks on the Y-axis.

xlab

A character giving label of the X-axis. The default is "Time (Months)".

ylab

A character giving label of the Y-axis. The default is "Survival probability".

km.legend

A character vector of length >=1 to appear in the legend.

km.title

A character used to set the main title at the top.

...

Refer to ggsurvplot for additional parameters..

Value

A Kaplan-Meier plot object that contains individual efficacy data from the intervention study and pseudo efficacy data from the comparator study.

Examples

unanchored_kmplot(
  unds_wts = unpts, unds.arm = ARM,
  unds.param.var = PARAMCD, unds.param = "OS",
  time = AVAL, status = CNSR, event = 0,
  wt.col = wt, km.xlim = 35, xstepby = 3,
  km.legend = c("Arm A", "ARM B"),
  km.title = "AAAA")

Conduct non-Anchored Matching-Adjusted Indirect Comparison (MAIC).

Description

Conduct non-Anchored Matching-Adjusted Indirect Comparison (MAIC).

Arguments

unds_wts

A combined data frame containing individual efficacy data from the intervention study and pseudo efficacy data from the comparator study.

unds.arm

The name of the grouping column in the combined data frame specified by unds_wts, e.g., comparator.arm = TRT. The default is TRT.

comparator.study

A character specifying or presenting the comparator study, e.g., comparator.study = "Study XX-1".

unds.param.var

The name of the column that specifies only a subset of the rows of the data to be used.

unds.param

A character specifying the subset of the rows to be used. This is the value of the column set by the unds.param.var.

time

The name of the survival or follow up time column in the combined data frame.

status

The status indicator, normally 0 = event, 1 = censored. Can be reseted using the event parameter.

event

A numeric value that represents the survival status, 0 = event, 1 = censored.

response

The name of the response status column in the unds_wts.

dtype

Two options are available: "HR" and "OR". The default is "HR".

wt.col

The name of the estimated weights column in the data frame specified by unds_wts. The default is wt.

CIw

The numeric value specifying the width of the confidence interval, with a default of 0.95.

digits

Specify the number of decimal places for the output results.

Value

A data frame containing the non-anchored matching-adjusted indirect comparison results.

Examples

results3 <- unanchored_maic(
  unds_wts = unpts, unds.arm = ARM,
  comparator.study = "Study XX-1",
  unds.param.var = PARAMCD, unds.param = "OS",
  time = AVAL, status = CNSR, event = 0,
  dtype = "HR")

results3

results4 <- unanchored_maic(
  unds_wts = unpts, unds.arm = ARM,
  #' unds.param = "ORR",
  #' comparator.study = "Study XX-1",
  response = CNSR,
  dtype = "OR")

results4

Conduct non-Anchored Matching-Adjusted Indirect Comparison (MAIC) and Calculate Confidence Intervals (CIs) Using Bootstrap.

Description

Two different methods for estimating a 95% confidence interval (CI) from
the bootstrap samples were explored:
* Percentile CIs
* Bias-corrected and accelerated (BCa) CIs

Arguments

ipds

A data frame containing individual patient data from the intervention study, with baseline characteristic variables for matching.

psds

A data frame containing pseudo data from the comparator study.

agds

A data frame containing aggregate summary data from the comparator study.

matching.list

A character list with two elements giving the names of variables for matching: the first is a vector of binary variables, and the second is a vector of continuous variables. The variable names must match the column names in ipds and agds. Use c() if a type is absent.

intervention.arm

The name of the grouping column in the data frame specified by ipds, e.g., intervention.arm = TRT. The default is TRT.

comparator

The name of the study column in the data frame specified by agds, e.g., comparator = STUDY. The default is STUDY.

comparator.study

A character specifying the comparator study, which must be quoted and cannot be empty (e.g., comparator.study = "Study XX-1"). This is the value of the study column in agds set by the comparator parameter.

comparator.arm

The name of the grouping column in the data frame specified by agds, e.g., comparator.arm = TRT. The default is TRT.

ipds.param.var

The name of the column that specifies only a subset of the ipds to be used.

ipds.param

A character specifying the subset of the rows to be used. This is the value of the column set by the ipds.param.var.

psds.param.var

The name of the column that specifies only a specifyed result of the psds to be used.

psds.param

A character specifying the subset of the rows to be used. This is the value of the column set by the psds.param.var.

time

The name of the survival or follow up time column.

status

The status indicator, normally 0 = event, 1 = censored. Can be reseted using the event parameter.

event

A numeric value that represents the survival status, 0 = event, 1 = censored.

response

The name of the response status column.

dtype

Two options are available: "HR" and "OR". The default is "HR".

n.samples

The number of bootstrap replicates.

CIw

The numeric value specifying the width of the confidence interval, with a default of 0.95.

digits

Specify the number of decimal places for the output results.

...

Refer to boot for additional parameters.

Value

A list containing 2 objects. First, a data frame containing the non-anchored matching-adjusted indirect comparison results. Second, a bootstrapping diagnostics histogram.

Examples

cov <- list(
  c("ECOG", "SMK", "METBRAIN"),
  c("BMI", "DIAG")
)

results5 <- unanchored_maic_bootstrap(
  ipds = IPD,
  agds = AgD_bl,
  psds = pseudo,
  matching.list = cov,
  intervention.arm = TRT,
  comparator = STUDY,
  comparator.study = "Study XX-1",
  comparator.arm = TRT,
  time = AVAL, status = CNSR, event = 0,
  dtype = "HR",
  ipds.param.var = PARAMCD, ipds.param = "OS",
  psds.param.var = NULL, psds.param = NULL,
  n.samples = 1000
)

results5$results
results5$plot

Description of unpts dataset

Description

A combined data frame containing individual efficacy data from the intervention study and pseudo efficacy data from the comparator study.

Usage

data(unpts)

Format

A data frame with X rows and Y variables:

SUBJID

Subject Unique Identifier.

PARAMCD

Subsets to be analyzed, e.g., "PFSINV", "OS".

ARM

Label of the study, "Intervention" for the intervention study and "Cmparator" for the comparator study.

AVAL

Survival or follow up time.

CNSR

The status indicator, 0 = event, 1 = censored.

wt

Weights to be used.

Examples

data(unpts)
  head(unpts)