Learn R Programming

outstandR (version 1.0.0)

calc_IPD_stats: Calculate individual-level patient data statistics

Description

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.

Usage

calc_IPD_stats(strategy, analysis_params, ...)

# S3 method for default calc_IPD_stats(...)

# S3 method for stc calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...)

# S3 method for maic calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...)

# S3 method for gcomp_ml calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...)

# S3 method for gcomp_bayes calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...)

# S3 method for mim calc_IPD_stats(strategy, analysis_params, var_method = NULL, ...)

Value

A list containing:

  • contrasts: A list with elements mean and var.

  • absolute: A list with elements mean and var.

Arguments

strategy

A list corresponding to different modelling approaches

analysis_params

A list containing:

  • ipd: Individual-level patient data (data frame)

  • ald: Aggregate-level trial data (data frame)

  • ref_trt: Treatment label for the reference arm (common; e.g., "C")

  • ipd_comp: Treatment label for the comparator arm in the IPD (e.g., "A")

  • scale: Scaling parameter ("log_odds", "risk_difference", "log_relative_risk")

...

Additional arguments

var_method

A string specifying the variance estimation method, either "sample" (default) or "sandwich".

Simulated treatment comparison statistics

IPD for reference "C" and comparator "A" trial arms are used to fit a regression model describing the observed outcomes \(y\) in terms of the relevant baseline characteristics \(x\) and the treatment variable \(z\).

Matching-adjusted indirect comparison statistics

Marginal IPD comparator treatment "A" vs reference treatment "C" treatment effect estimates using bootstrapping sampling.

G-computation maximum likelihood statistics

Compute a non-parametric bootstrap with default \(R=1000\) resamples.

G-computation Bayesian statistics

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.

Multiple imputation marginalisation

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.

Examples

Run this code
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"))
  

Run the code above in your browser using DataLab