| Title: | Model-Based Standardisation for Indirect Treatment Comparison with Limited Subject-Level Data |
|---|---|
| Description: | For the problem of indirect treatment comparison with limited subject-level data, this package provides tools for model-based standardisation with several different computation approaches. See Remiro‐Azócar A, Heath A, Baio G (2022) ``Parametric G‐computation for compatible indirect treatment comparisons with limited individual patient data'', Res. Synth. Methods, 1–31. ISSN 1759-2879, <doi:10.1002/jrsm.1565>. |
| Authors: | Nathan Green [aut, cre, cph] (ORCID: <https://orcid.org/0000-0003-2745-1736>, ROR: <https://ror.org/02jx3x895>), Chengyang Gao [aut], Antonio Remiro-Azocar [aut] (ORCID: <https://orcid.org/0000-0002-7263-4251>) |
| Maintainer: | Nathan Green <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0.0.9000 |
| Built: | 2026-05-19 17:25:23 UTC |
| Source: | https://github.com/statisticshealtheconomics/outstandR |
This data set contains simulated patient covariate and outcome values.
data(AC_IPD_binY_contX)data(AC_IPD_binY_contX)
y ~ PF_cont_1 + PF_cont_2 + trt + trt:(EM_cont_1 + EM_cont_2)Numeric unique identifier
Numeric prognostic factor continuous covariate
Numeric prognostic factor continuous covariate
Numeric effect modifier continuous covariate
Numeric effect modifier continuous covariate
Factor treatment identifier. Levels A, C
Integer binary outcome
Numeric linear predictor
Simulated data
Remiro‐Azocar A, Heath A, Baio G (2022)
This data set contains simulated patient covariate and outcome values. Corresponds to ALD data set.
data(AC_IPD_contY_mixedX)data(AC_IPD_contY_mixedX)
y ~ X1 + X3 + X4 + trt + trt:(X2 + X3 + X4)Numeric unique identifier
Numeric prognostic factor continuous covariate
Numeric prognostic factor and effect modifier binary covariate
Numeric prognostic factor and effect modifier continuous covariate
Numeric effect modifier binary covariate
Factor treatment identifier. Levels A, C
Integer binary outcome
Numeric linear predictor
Simulated data
Remiro‐Azocar A, Heath A, Baio G (2022)
This data set contains simulated patient covariate and outcome values. Corresponds to ALD data set.
data(AC_IPD_countY_contX)data(AC_IPD_countY_contX)
y ~ PF_cont_1 + PF_cont_2 + trt + trt:(EM_cont_1 + EM_cont_2)Numeric unique identifier
Numeric prognostic factor continuous covariate
Numeric prognostic factor continuous covariate
Numeric effect modifier continuous covariate
Numeric effect modifier continuous covariate
Factor treatment identifier. Levels A, C
Integer non-negative count outcome
Numeric linear predictor
Simulated data
Remiro‐Azocar A, Heath A, Baio G (2022)
This data set contains summaries of simulated patient covariate and outcome values.
data(BC_ALD_binY_contX)data(BC_ALD_binY_contX)
y ~ PF_cont_1 + PF_cont_2 + trt + trt:(EM_cont_1 + EM_cont_2)String covariate or outcome name. From EM_cont_1, EM_cont_2, PF_cont_1, PF_cont_2, y.
String summary statistic name. From mean, sd, sum, N
Numeric value
Treatment (arm) name. From B, C
Simulated data
Remiro‐Azocar A, Heath A, Baio G (2022)
This data set contains summaries of simulated patient covariate and outcome values. Corresponds to IPD data set.
data(BC_ALD_contY_mixedX)data(BC_ALD_contY_mixedX)
y ~ X1 + X3 + X4 + trt + trt:(X2 + X3 + X4)String covariate or outcome name. From X1, X2, X3, X4, y.
String summary statistic name. From mean, sd, prob, sum, N
Numeric value
Treatment (arm) name. From B, C
Simulated data
Remiro‐Azocar A, Heath A, Baio G (2022)
This data set contains summaries of simulated patient covariate and outcome values. Corresponds to IPD data set.
data(BC_ALD_countY_contX)data(BC_ALD_countY_contX)
y ~ PF_cont_1 + PF_cont_2 + trt + trt:(EM_cont_1 + EM_cont_2)String covariate or outcome name. From EM_cont_1, EM_cont_2, PF_cont_1, PF_cont_2, y.
String summary statistic name. From mean, sd, sum, N
Numeric value
Treatment (arm) name. From B, C
Simulated data
Remiro‐Azocar A, Heath A, Baio G (2022)
Computes the mean and variance of marginal treatment effects for aggregate-level trial data.
calc_ALD_stats(strategy, analysis_params)calc_ALD_stats(strategy, analysis_params)
strategy |
A list containing the strategy details, including the family distribution. |
analysis_params |
A list containing:
|
A list containing:
meanThe marginal treatment effect mean.
varThe marginal treatment effect variance.
marginal_treatment_effect(), marginal_variance()
strategy <- list(family = list(family = "binomial")) # basic version ald <- data.frame(trt = c("B","C","B","C"), variable = c(NA, NA, "y", "y"), statistic = c("N", "N", "sum", "sum"), value = c(100, 100, 50, 60)) calc_ALD_stats(strategy = strategy, list(ald = ald, ref_trt = "C", ald_comp = "B", scale = "log_odds"))strategy <- list(family = list(family = "binomial")) # basic version ald <- data.frame(trt = c("B","C","B","C"), variable = c(NA, NA, "y", "y"), statistic = c("N", "N", "sum", "sum"), value = c(100, 100, 50, 60)) calc_ALD_stats(strategy = strategy, list(ald = ald, ref_trt = "C", ald_comp = "B", scale = "log_odds"))
Calculate draws of binary responses from posterior predictive distribution from the Bayesian G-computation method using Hamiltonian Monte Carlo.
calc_gcomp_bayes(strategy, analysis_params, ...)calc_gcomp_bayes(strategy, analysis_params, ...)
strategy |
A list specifying the model strategy, including:
|
analysis_params |
List of analysis parameters. Must contain |
... |
Additional arguments passed to |
A list containing:
means: A list containing:
A: Posterior means for comparator treatment group "A".
C: Posterior means for reference treatment group "C".
model: A list containing the fit object (from stan_glm), rho, N,
and stan_args.
strategy <- list( formula = y ~ trt:X1, family = binomial(), rho = NA, N = 1000L, marginal_distns = NA, marginal_params = NA, trt_var = "trt", iter = 2000, warmup = 500, chains = 4) ipd <- data.frame( trt = sample(c("A", "C"), size = 100, replace = TRUE), X1 = rnorm(100, 1, 1), y = sample(c(1,0), size = 100, prob = c(0.7, 0.3), replace = TRUE)) ald <- data.frame( trt = c(NA, NA, "B", "C", "B", "C"), variable = c("X1", "X1", "y", "y", NA, NA), statistic = c("mean", "sd", "sum", "sum", "N", "N"), value = c(0.5, 0.1, 10, 12, 20, 25)) calc_gcomp_bayes( strategy, analysis_params = list( ipd = ipd, ald = ald, ref_trt = "C", ipd_comp = "A"))strategy <- list( formula = y ~ trt:X1, family = binomial(), rho = NA, N = 1000L, marginal_distns = NA, marginal_params = NA, trt_var = "trt", iter = 2000, warmup = 500, chains = 4) ipd <- data.frame( trt = sample(c("A", "C"), size = 100, replace = TRUE), X1 = rnorm(100, 1, 1), y = sample(c(1,0), size = 100, prob = c(0.7, 0.3), replace = TRUE)) ald <- data.frame( trt = c(NA, NA, "B", "C", "B", "C"), variable = c("X1", "X1", "y", "y", NA, NA), statistic = c("mean", "sd", "sum", "sum", "N", "N"), value = c(0.5, 0.1, 10, 12, 20, 25)) calc_gcomp_bayes( strategy, analysis_params = list( ipd = ipd, ald = ald, ref_trt = "C", ipd_comp = "A"))
Computes the mean difference in treatment effects using bootstrap resampling.
calc_gcomp_ml(strategy, analysis_params)calc_gcomp_ml(strategy, analysis_params)
strategy |
A list specifying the model strategy, including:
|
analysis_params |
List of analysis parameters. |
A list containing:
means: A list containing:
A: Bootstrap estimates for comparator treatment group "A".
C: Bootstrap estimates for reference treatment group "C".
model: A list containing the fit object, rho, and N.
strategy <- list( formula = y ~ trt:X1, family = binomial(), rho = NA, N = 1000L, n_boot = 100L, marginal_distns = NA, marginal_params = NA, trt_var = "trt") ipd <- data.frame(trt = sample(c("A", "C"), size = 100, replace = TRUE), X1 = rnorm(100, 1, 1), y = sample(c(1,0), size = 100, prob = c(0.7,0.3), replace = TRUE)) ald <- data.frame(trt = c(NA, NA, "B", "C", "B", "C"), variable = c("X1", "X1", "y", "y", NA, NA), statistic = c("mean", "sd", "sum", "sum", "N", "N"), value = c(0.5, 0.1, 10, 12, 20, 25)) calc_gcomp_ml( strategy, analysis_params = list(ipd = ipd, ald = ald, ref_trt = "C", ipd_comp = "A"))strategy <- list( formula = y ~ trt:X1, family = binomial(), rho = NA, N = 1000L, n_boot = 100L, marginal_distns = NA, marginal_params = NA, trt_var = "trt") ipd <- data.frame(trt = sample(c("A", "C"), size = 100, replace = TRUE), X1 = rnorm(100, 1, 1), y = sample(c(1,0), size = 100, prob = c(0.7,0.3), replace = TRUE)) ald <- data.frame(trt = c(NA, NA, "B", "C", "B", "C"), variable = c("X1", "X1", "y", "y", NA, NA), statistic = c("mean", "sd", "sum", "sum", "N", "N"), value = c(0.5, 0.1, 10, 12, 20, 25)) calc_gcomp_ml( strategy, analysis_params = list(ipd = ipd, ald = ald, ref_trt = "C", ipd_comp = "A"))
Computes mean and variance statistics for individual-level patient data using various approaches, including Matching-Adjusted Indirect Comparison (MAIC), Simulated Treatment Comparison (STC), and G-computation via Maximum Likelihood Estimation (MLE) or Bayesian inference.
calc_IPD_stats(strategy, analysis_params, ...) ## Default S3 method: calc_IPD_stats(...) ## S3 method for class 'stc' calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...) ## S3 method for class 'maic' calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...) ## S3 method for class 'gcomp_ml' calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...) ## S3 method for class 'gcomp_bayes' calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...) ## S3 method for class 'mim' calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...)calc_IPD_stats(strategy, analysis_params, ...) ## Default S3 method: calc_IPD_stats(...) ## S3 method for class 'stc' calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...) ## S3 method for class 'maic' calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...) ## S3 method for class 'gcomp_ml' calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...) ## S3 method for class 'gcomp_bayes' calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...) ## S3 method for class 'mim' calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...)
strategy |
A list corresponding to different modelling approaches |
analysis_params |
A list containing:
|
... |
Additional arguments |
var_method |
A string specifying the variance estimation method, either "sample" (default) or "sandwich". |
A list containing:
contrasts: A list with elements mean and var.
absolute: A list with elements mean and var.
IPD for reference "C" and comparator "A" trial arms are used to fit a regression model describing the
observed outcomes in terms of the relevant baseline characteristics and
the treatment variable .
Marginal IPD comparator treatment "A" vs reference treatment "C" treatment effect estimates using bootstrapping sampling.
Compute a non-parametric bootstrap with default resamples.
Using Stan, compute marginal relative effects for IPD comparator "A" vs reference "C" treatment arms for each MCMC sample by transforming from probability to linear predictor scale.
Using Stan, compute marginal relative treatment effect for IPD comparator "A" vs reference "C" arms for each MCMC sample by transforming from probability to linear predictor scale. Approximate by using imputation and combining estimates using Rubin's rules.
strategy <- strategy_maic(formula = as.formula(y~trt:X1), family = binomial()) ipd <- data.frame(trt = sample(c("A", "C"), size = 100, replace = TRUE), X1 = rnorm(100, 1, 1), y = sample(c(1,0), size = 100, prob = c(0.7,0.3), replace = TRUE)) ald <- data.frame(trt = c(NA, "B", "C", "B", "C"), variable = c("X1", "y", "y", NA, NA), statistic = c("mean", "sum", "sum", "N", "N"), value = c(0.5, 10, 12, 20, 25)) calc_IPD_stats(strategy, analysis_params = list(ipd = ipd, ald = ald, scale = "log_odds"))strategy <- strategy_maic(formula = as.formula(y~trt:X1), family = binomial()) ipd <- data.frame(trt = sample(c("A", "C"), size = 100, replace = TRUE), X1 = rnorm(100, 1, 1), y = sample(c(1,0), size = 100, prob = c(0.7,0.3), replace = TRUE)) ald <- data.frame(trt = c(NA, "B", "C", "B", "C"), variable = c("X1", "y", "y", NA, NA), statistic = c("mean", "sum", "sum", "N", "N"), value = c(0.5, 10, 12, 20, 25)) calc_IPD_stats(strategy, analysis_params = list(ipd = ipd, ald = ald, scale = "log_odds"))
Computes the average treatment effect (ATE) based on the specified effect scale.
calculate_ate(mean_comp, mean_ref, effect)calculate_ate(mean_comp, mean_ref, effect)
mean_comp, mean_ref
|
Mean of the outcome for the comparator and reference / common |
effect |
A character string specifying the effect scale. Options are:
|
Numeric computed average treatment effect on the specified scale.
calculate_ate(mean_comp = 0.7, mean_ref = 0.5, effect = "log_odds") calculate_ate(mean_comp = 0.7, mean_ref = 0.5, effect = "risk_difference")calculate_ate(mean_comp = 0.7, mean_ref = 0.5, effect = "log_odds") calculate_ate(mean_comp = 0.7, mean_ref = 0.5, effect = "risk_difference")
Calculate Trial Mean Wrapper
calculate_trial_mean(ald, tid, effect, family)calculate_trial_mean(ald, tid, effect, family)
ald |
Aggregate level data. Data frame in long format. |
tid |
Treatment ID |
effect |
Effect name. String. |
family |
Family distribution |
Numeric mean value.
Calculate Trial Mean Binary Data
calculate_trial_mean_binary(ald, tid, effect)calculate_trial_mean_binary(ald, tid, effect)
ald |
Aggregate level data. Data frame in long format. |
tid |
Treatment ID |
effect |
Effect name. String. |
Numeric mean value.
Calculate Trial Mean Continuous Data
calculate_trial_mean_continuous(ald, tid, effect, verbatim = FALSE)calculate_trial_mean_continuous(ald, tid, effect, verbatim = FALSE)
ald |
Aggregate level data. Data frame in long format. |
tid |
Treatment ID |
effect |
Effect name. String. |
verbatim |
Print messages, logical |
Numeric mean value.
Calculate Trial Mean Count Data
calculate_trial_mean_count(ald, tid, effect, verbatim = FALSE)calculate_trial_mean_count(ald, tid, effect, verbatim = FALSE)
ald |
Aggregate level data. Data frame in long format. |
tid |
Treatment ID |
effect |
Effect name. String. |
verbatim |
Print messages, logical |
Numeric mean value.
Computes the variance of treatment effects for a trial based on the specified family distribution.
calculate_trial_variance(ald, tid, effect, family)calculate_trial_variance(ald, tid, effect, family)
ald |
Aggregate-level data. Data frame. |
tid |
Treatment identifier used to extract relevant columns from |
effect |
A character string specifying the effect scale (e.g., "log_odds", "risk_difference"). |
family |
A character string specifying the model family (e.g., "binomial", "gaussian"). |
Numeric computed variance of treatment effects.
ald <- data.frame(trt = c("B","C","B","C"), variable = c(NA, NA, "y", "y"), statistic = c("N", "N", "sum", "sum"), value = c(100, 100, 50, 60)) calculate_trial_variance( ald, tid = "B", effect = "log_odds", family = "binomial")ald <- data.frame(trt = c("B","C","B","C"), variable = c(NA, NA, "y", "y"), statistic = c("N", "N", "sum", "sum"), value = c(100, 100, 50, 60)) calculate_trial_variance( ald, tid = "B", effect = "log_odds", family = "binomial")
Calculate trial variance binary
calculate_trial_variance_binary(ald, tid, effect)calculate_trial_variance_binary(ald, tid, effect)
ald |
Aggregate level data |
tid |
Treatment ID |
effect |
Effect |
Numeric value of total variance.
Calculate trial variance continuous
calculate_trial_variance_continuous(ald, tid, effect, verbatim = FALSE)calculate_trial_variance_continuous(ald, tid, effect, verbatim = FALSE)
ald |
Aggregate level data. Data frame in long format. |
tid |
Treatment ID |
effect |
Effect name. String. |
verbatim |
Print messages, logical |
Numeric value of total variance.
Calculate trial variance count
calculate_trial_variance_count(ald, tid, effect)calculate_trial_variance_count(ald, tid, effect)
ald |
Aggregate level data. Data frame in long format. |
tid |
Treatment ID. |
effect |
Effect name. String. |
Numeric value of total variance.
Computes the robust (sandwich) variance estimator for the treatment effect.
estimate_var_sandwich(strategy, analysis_params, ...)estimate_var_sandwich(strategy, analysis_params, ...)
strategy |
An object of class |
analysis_params |
List of analysis parameters (ipd, ald, etc.) |
... |
Additional arguments |
Numeric variance estimate for the treatment contrast
Maps a given link function to its corresponding treatment effect scale.
get_treatment_effect(link)get_treatment_effect(link)
link |
A character string specifying the link function. Options are:
|
A character string representing the treatment effect scale.
get_treatment_effect(link = "logit") get_treatment_effect(link = "identity")get_treatment_effect(link = "logit") get_treatment_effect(link = "identity")
Computes the relative treatment effect from aggregate-level data using event counts.
marginal_treatment_effect(ald, ref_trt = NA, comp_trt = NA, scale, family)marginal_treatment_effect(ald, ref_trt = NA, comp_trt = NA, scale, family)
ald |
Aggregate-level data |
ref_trt |
Treatment labels reference (common; e.g. placebo) |
comp_trt |
Treatment labels comparator |
scale |
A scaling parameter for the calculation. |
family |
A character string specifying the family distribution (e.g., "binomial"). |
Numeric relative treatment effect.
ald <- data.frame(trt = c("B","C","B","C"), variable = c(NA, NA, "y", "y"), statistic = c("N", "N", "sum", "sum"), value = c(100, 100, 50, 60)) marginal_treatment_effect(ald, ref_trt = "C", comp_trt = "B", scale = "log_odds", family = "binomial")ald <- data.frame(trt = c("B","C","B","C"), variable = c(NA, NA, "y", "y"), statistic = c("N", "N", "sum", "sum"), value = c(100, 100, 50, 60)) marginal_treatment_effect(ald, ref_trt = "C", comp_trt = "B", scale = "log_odds", family = "binomial")
Computes the total variance of marginal treatment effects using the delta method.
marginal_variance(ald, ref_trt = NA, comp_trt = NA, scale, family)marginal_variance(ald, ref_trt = NA, comp_trt = NA, scale, family)
ald |
Aggregate-level data |
ref_trt |
Treatment labels reference (common; e.g. placebo) |
comp_trt |
Treatment labels comparator |
scale |
A scaling parameter for the calculation. |
family |
A character string specifying the family distribution (e.g., "binomial"). |
Numeric total variance of marginal treatment effects.
ald <- data.frame(trt = c("B","C","B","C"), variable = c(NA, NA, "y", "y"), statistic = c("N", "N", "sum", "sum"), value = c(100, 100, 50, 60)) marginal_variance(ald, ref_trt = "C", comp_trt = "B", scale = "log_odds", family = "binomial")ald <- data.frame(trt = c("B","C","B","C"), variable = c(NA, NA, "y", "y"), statistic = c("N", "N", "sum", "sum"), value = c(100, 100, 50, 60)) marginal_variance(ald, ref_trt = "C", comp_trt = "B", scale = "log_odds", family = "binomial")
This is the main, top-level wrapper for {outstandR}.
Methods taken from
(Remiro‐Azócar et al. 2022).
outstandR( ipd_trial, ald_trial, strategy, ref_trt = NA, CI = 0.95, scale = NULL, var_method = NULL, seed = NULL, ... )outstandR( ipd_trial, ald_trial, strategy, ref_trt = NA, CI = 0.95, scale = NULL, var_method = NULL, seed = NULL, ... )
ipd_trial |
Individual-level patient data. For example, suppose between studies A and C. In a long format and must contain a treatment column and outcome column consistent with the formula object. The labels in the treatment are used internally so there must be a common treatment with the aggregate-level data trial. |
ald_trial |
Aggregate-level data. For example, suppose between studies B and C. The column names are
|
strategy |
Computation strategy function. These can be
|
ref_trt |
Reference / common / anchoring treatment name. |
CI |
Confidence interval level; between 0,1 with default 0.95. |
scale |
Relative treatment effect scale. If |
var_method |
Variance estimation method. |
seed |
Random seed. |
... |
Additional arguments. Currently, can pass named arguments to |
List of length 11 of statistics as a outstandR class object.
Containing statistics between each pair of treatments.
These are the mean, variances and confidence intervals,
for contrasts and absolute values.
Remiro‐Azócar A, Heath A, Baio G (2022). “Parametric G‐computation for compatible indirect treatment comparisons with limited individual patient data.” Res. Synth. Methods, 1–31. ISSN 1759-2879. doi:10.1002/jrsm.1565. 2108.12208.
strategy_maic() strategy_stc() strategy_gcomp_ml() strategy_gcomp_bayes()
data(AC_IPD_binY_contX) # A vs C individual patient-level data data(BC_ALD_binY_contX) # B vs C aggregate-level data # linear formula lin_form <- as.formula("y ~ PF_cont_1 + PF_cont_2 + trt*EM_cont_1 + trt*EM_cont_2") # sampling values of additional arguments picked for speed # select appropriate to specific analysis # matching-adjusted indirect comparison outstandR_maic <- outstandR( AC_IPD_binY_contX, BC_ALD_binY_contX, strategy = strategy_maic(formula = lin_form, n_boot = 100)) # simulated treatment comparison outstandR_stc <- outstandR( AC_IPD_binY_contX, BC_ALD_binY_contX, strategy = strategy_stc(lin_form)) # G-computation with maximum likelihood outstandR_gcomp_ml <- outstandR( AC_IPD_binY_contX, BC_ALD_binY_contX, strategy = strategy_gcomp_ml(lin_form, n_boot = 100, N =100)) # G-computation with Bayesian inference outstandR_gcomp_bayes <- outstandR( AC_IPD_binY_contX, BC_ALD_binY_contX, strategy = strategy_gcomp_bayes(lin_form), chains = 1, iter = 1000, warmup = 20) # Multiple imputation marginalization outstandR_mim <- outstandR( AC_IPD_binY_contX, BC_ALD_binY_contX, strategy = strategy_mim(lin_form, N = 100), # size of pseudo-population chains = 1, iter = 1000, warmup = 20)data(AC_IPD_binY_contX) # A vs C individual patient-level data data(BC_ALD_binY_contX) # B vs C aggregate-level data # linear formula lin_form <- as.formula("y ~ PF_cont_1 + PF_cont_2 + trt*EM_cont_1 + trt*EM_cont_2") # sampling values of additional arguments picked for speed # select appropriate to specific analysis # matching-adjusted indirect comparison outstandR_maic <- outstandR( AC_IPD_binY_contX, BC_ALD_binY_contX, strategy = strategy_maic(formula = lin_form, n_boot = 100)) # simulated treatment comparison outstandR_stc <- outstandR( AC_IPD_binY_contX, BC_ALD_binY_contX, strategy = strategy_stc(lin_form)) # G-computation with maximum likelihood outstandR_gcomp_ml <- outstandR( AC_IPD_binY_contX, BC_ALD_binY_contX, strategy = strategy_gcomp_ml(lin_form, n_boot = 100, N =100)) # G-computation with Bayesian inference outstandR_gcomp_bayes <- outstandR( AC_IPD_binY_contX, BC_ALD_binY_contX, strategy = strategy_gcomp_bayes(lin_form), chains = 1, iter = 1000, warmup = 20) # Multiple imputation marginalization outstandR_mim <- outstandR( AC_IPD_binY_contX, BC_ALD_binY_contX, strategy = strategy_mim(lin_form, N = 100), # size of pseudo-population chains = 1, iter = 1000, warmup = 20)
The outstandR class contains the results from running a
model with the function outstandR().
Objects of class outstandR have the following
A list containing statistics for relative treatment effects:
means: Estimated relative effects (e.g., log-odds ratios, risk differences).
variances: Variance-covariance matrix of the relative effects.
contrast_ci: Confidence intervals for the relative effects.
A list containing statistics for absolute treatment outcomes:
means: Estimated absolute outcomes (e.g., probabilities, mean response).
variances: Variance-covariance matrix of the absolute outcomes.
ci: Confidence intervals for the absolute outcomes.
The confidence level used (e.g., 0.95).
The name of the reference treatment.
The scale of the outcome (e.g., "log odds", "probability").
A list containing details of the underlying statistical model. Contents vary by strategy:
family: The error distribution and link function.
fit: The underlying model object (e.g., for STC, G-Comp ML, or Bayesian G-Comp).
weights, ESS: (MAIC only) The estimated weights and Effective Sample Size.
stan_args: (Bayesian G-Comp, MIM) Arguments passed to Stan.
rho: (G-Comp ML, MIM, Bayesian G-Comp) Correlation coefficient.
N: (G-Comp ML, MIM, Bayesian G-Comp) Number of iterations.
nu, hats.v, M: (MIM only) Imputation parameters and matrices.
Default Plot Method for outstandR Objects
## S3 method for class 'outstandR' plot(x, ..., type = c("both", "contrasts", "absolute"), labels = NULL)## S3 method for class 'outstandR' plot(x, ..., type = c("both", "contrasts", "absolute"), labels = NULL)
x |
An object of class 'outstandR' or a list of 'outstandR' objects. |
... |
Additional 'outstandR' objects for comparison. |
type |
Character, one of "both" (default), "contrasts", or "absolute". |
labels |
Optional character vector of names for the models. |
A ggplot2::ggplot() object representing the forest plot of the results.
This is a method for the function print() for objects of the
class "outstandR" created by a call to outstandR()
## S3 method for class 'outstandR' print(x, ...)## S3 method for class 'outstandR' print(x, ...)
x |
Objects of the class "outstandR" |
... |
Additional arguments passed to other methods |
No return value, called for side effects
Convert aggregate data from wide to long format
reshape_ald_to_long(df)reshape_ald_to_long(df)
df |
A dataframe of ALD |
Data frame in long format
Convert aggregate data from long to wide format
reshape_ald_to_wide(df)reshape_ald_to_wide(df)
df |
A Dataframe of ALD |
Data frame in wide format
df <- data.frame( variable = c("age", "age", "y", "y", "y", "y", "y", "y", "y", "y"), statistic = c("mean", "sd", "sum", "bar", "sd", "N", "sum", "bar", "sd", "N"), trt = c(NA, NA, "B", "B", "B", "B", "C", "C", "C", "C"), value = c(1,1,1,1,1,1,1,1,1,1))df <- data.frame( variable = c("age", "age", "y", "y", "y", "y", "y", "y", "y", "y"), statistic = c("mean", "sd", "sum", "bar", "sd", "N", "sum", "bar", "sd", "N"), trt = c(NA, NA, "B", "B", "B", "B", "C", "C", "C", "C"), value = c(1,1,1,1,1,1,1,1,1,1))
Create a type of strategy class for each modelling approach.
strategy_maic( formula = NULL, family = gaussian(link = "identity"), trt_var = NULL, n_boot = 1000L ) strategy_stc( formula = NULL, family = gaussian(link = "identity"), trt_var = NULL ) strategy_gcomp_ml( formula = NULL, family = gaussian(link = "identity"), trt_var = NULL, rho = NA, marginal_distns = NA, marginal_params = NA, n_boot = 1000L, N = 1000L ) strategy_gcomp_bayes( formula = NULL, family = gaussian(link = "identity"), trt_var = NULL, rho = NA, marginal_distns = NA, marginal_params = NA, N = 1000L ) strategy_mim( formula = NULL, family = gaussian(link = "identity"), trt_var = NULL, rho = NA, N = 1000L ) new_strategy(strategy, ...)strategy_maic( formula = NULL, family = gaussian(link = "identity"), trt_var = NULL, n_boot = 1000L ) strategy_stc( formula = NULL, family = gaussian(link = "identity"), trt_var = NULL ) strategy_gcomp_ml( formula = NULL, family = gaussian(link = "identity"), trt_var = NULL, rho = NA, marginal_distns = NA, marginal_params = NA, n_boot = 1000L, N = 1000L ) strategy_gcomp_bayes( formula = NULL, family = gaussian(link = "identity"), trt_var = NULL, rho = NA, marginal_distns = NA, marginal_params = NA, N = 1000L ) strategy_mim( formula = NULL, family = gaussian(link = "identity"), trt_var = NULL, rho = NA, N = 1000L ) new_strategy(strategy, ...)
formula |
Linear regression |
family |
A 'family' object specifying the distribution and link function (e.g., 'binomial'). See stats::family() for more details. |
trt_var |
Treatment variable name; string |
n_boot |
The number of resamples used for the non-parametric bootstrap; integer |
rho |
A named square matrix of covariate correlations; default NA |
marginal_distns |
Marginal distributions names; vector default NA.
Available distributions are given in stats::Distributions. See |
marginal_params |
Marginal distributions parameters; list of lists, default NA. See |
N |
Synthetic sample size for g-computation |
strategy |
Class name from |
... |
Additional arguments |
maic class object
stc class object
gcomp_ml class object
gcomp_bayes class object
mim class object
Strategy list object
MAIC is a form of non-parametric likelihood reweighting method
which allows the propensity score logistic
regression model to be estimated without IPD in the AC population.
The mean outcomes on treatment in the AC
target population are estimated by taking a weighted average of the
outcomes of the individuals in arm of the AB population.
Used to compare marginal treatment effects where there are cross-trial differences in effect modifiers and limited patient-level data.
where the weight assigned to the -th individual receiving treatment
is equal to the odds of being enrolled in the AC trial vs the AB trial.
Outcome regression-based method which targets a conditional treatment effect. STC is a modification of the covariate adjustment method. An outcome model is fitted using IPD in the AB trial. For example,
where is an intercept term, is a vector of coefficients for
prognostic variables, is the relative effect of treatment B compared
to A at , is a vector of coefficients for effect
modifiers subvector of the full covariate vector ), and
is the expected outcome of an individual assigned
treatment with covariate values which is transformed onto a
chosen linear predictor scale with link function .
G-computation marginalizes the conditional estimates by separating the regression modelling
from the estimation of the marginal treatment effect for A versus C.
For example, a regression model of the observed outcome on the covariates and
treatment is fitted to the AC IPD:
In the context of G-computation, this regression model is called the “Q-model".
Having fitted the Q-model, the regression coefficients are treated as nuisance parameters.
The parameters are applied to the simulated covariates to predict hypothetical outcomes
for each subject under both possible treatments. Namely, a pair of predicted outcomes,
also called potential outcomes, under A and under C, is generated for each subject.
By plugging treatment C into the regression fit for every simulated observation, we predict the marginal outcome mean in the hypothetical scenario in which all units are under treatment C:
To estimate the marginal or population-average treatment effect for A versus C in the linear predictor scale, one back-transforms to this scale the average predictions, taken over all subjects on the natural outcome scale, and calculates the difference between the average linear predictions:
The difference between Bayesian G-computation and its maximum-likelihood counterpart is in the estimated distribution of the predicted outcomes. The Bayesian approach also marginalizes, integrates or standardizes over the joint posterior distribution of the conditional nuisance parameters of the outcome regression, as well as the joint covariate distribution.
Draw a vector of size of predicted outcomes under each set
intervention from its posterior predictive distribution
under the specific treatment. This is defined as
where is the
posterior distribution of the outcome regression coefficients ,
which encode the predictor-outcome relationships observed in the AC trial IPD.
This is given by:
In practice, the integrals above can be approximated numerically, using full Bayesian estimation via Markov chain Monte Carlo (MCMC) sampling.
TODO
While current implementations focus on binary, continuous, and count outcomes,
support for survival data (using the survival package) is under active
development and scheduled for version 1.1.0.
strategy_gcomp_ml(),copula::Mvdc()
The strategy class is a virtual class that defines the statistical approach
for population adjustment in indirect treatment comparisons
These objects are constructors that validate hyperparameters and encapsulate
modelling settings before execution by outstandR()
Objects of class strategy have a common structure but carry
different subclasses to trigger specific S3 method dispatch
Shared by all strategies:
formula: The linear regression formula for the outcome model
family: A base R family object specifying the distribution and link
trt_var: The name of the treatment variable.
Additional fields for Matching-Adjusted Indirect Comparison:
n_boot: Number of bootstrap resamples for variance estimation.
Additional fields for Simulated Treatment Comparison:
N: Synthetic sample size for the target population.
Additional fields for Maximum Likelihood G-computation:
rho: Named square matrix of covariate correlations.
marginal_distns: Names of the marginal distributions for covariates.
marginal_params: Parameters for the marginal distributions.
N: Synthetic sample size for the pseudo-population.
n_boot: Number of bootstrap resamples.
Additional fields for Bayesian G-computation:
rho, marginal_distns, marginal_params, N: Same as gcomp_ml.
...: Additional arguments passed to the Stan engine via rstanarm::stan_glm().
Additional fields for Multiple Imputation Marginalization:
rho: Correlation matrix.
N: Number of iterations/simulated individuals.
Summary method for outstandR
## S3 method for class 'outstandR' summary(object, CI = NA, ...) ## S3 method for class 'summary.outstandR' print(x, digits = 3, ...)## S3 method for class 'outstandR' summary(object, CI = NA, ...) ## S3 method for class 'summary.outstandR' print(x, digits = 3, ...)
object |
|
CI |
Confidence interval level. |
... |
Additional arguments. |
x |
An object used to select a method. |
digits |
Minimal number of significant digits, see |
List of class summary.outstandR
Original argument, but mainly called for side effects