Package {cdtmbnma}


Type: Package
Title: Component, Dose, and Time Network Meta-Analysis with Dose-Dependent Interactions
Version: 0.2.1
Date: 2026-07-10
Description: Bayesian component model-based network meta-analysis for treatment combinations with explicit component dose-response and dose-dependent interaction surfaces. The main interface fits single-timepoint arm-level networks with continuous or binary outcomes, any number of components, additive, bilinear, or saturating pairwise interactions, study-level random effects, and prediction at unobserved dose combinations. A stage-one longitudinal interface fits a two-component exponential time-course model with a bilinear interaction on the asymptote. Estimation uses 'Stan' through 'cmdstanr' or 'rstan'. Methods are described in Welton et al. (2009) <doi:10.1093/aje/kwp014>, Mawdsley et al. (2016) <doi:10.1002/psp4.12091>, Wicha et al. (2017) <doi:10.1038/s41467-017-01929-y>, and Pedder et al. (2019) <doi:10.1002/jrsm.1351>.
License: MIT + file LICENSE
Encoding: UTF-8
Depends: R (≥ 4.1.0)
Imports: posterior, stats, graphics, grDevices, utils
Suggests: cmdstanr, rstan, testthat (≥ 3.0.0), knitr, rmarkdown, loo
Additional_repositories: https://stan-dev.r-universe.dev
SystemRequirements: A working Stan backend through cmdstanr/CmdStan or rstan.
VignetteBuilder: knitr
RoxygenNote: 7.3.2
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-07-10 12:39:43 UTC; tyler-pitre
Author: Tyler Pitre [aut, cre]
Maintainer: Tyler Pitre <pitretmed@gmail.com>
Repository: CRAN
Date/Publication: 2026-07-22 08:30:21 UTC

Component, Dose, and Time Network Meta-Analysis

Description

Bayesian component model-based network meta-analysis for treatment combinations with explicit component dose-response and dose-dependent interaction surfaces. The main model supports single-timepoint arm-level networks with continuous or binary outcomes. A stage-one interface supports a two-component exponential time-course model for repeated arm means.

Details

The single-timepoint workflow is cdt_data() followed by cdt_fit(), or the one-call wrapper cdtmbnma(). Estimation uses Stan through either cmdstanr or rstan. Fitted objects have summary(), coef(), plot(), and predict() methods.

Interaction surfaces

none

Additive component effects.

bilinear

One parameter per component pair; the interaction grows with the product of normalised component doses.

gpdi

A saturating general pharmacodynamic interaction surface.

Author(s)

Tyler Pitre


Amlodipine-Anchored Hypertension Factorial Extraction Template

Description

Reads the package's antihypertensive factorial extraction form or data dictionary.

Usage

antihtn_factorial_template(type = c("extraction", "dictionary"))

Arguments

type

Either "extraction" or "dictionary".

Value

A data frame.


Assemble a Component Dose-Response Network

Description

Turns an arm-level data frame into the design consumed by cdt_fit(). Every component named in components must have a dose column, and zero means the component is absent from that arm.

Usage

cdt_data(data, study, components, outcome = c("continuous", "binary"),
  y = NULL, se = NULL, sd = NULL, n = NULL,
  events = NULL, n_binary = NULL, ref = NULL,
  dstar = NULL, interactions = NULL)

Arguments

data

A data frame with one row per study arm.

study

Name of the column identifying the study.

components

Character vector of component dose column names. A value of zero marks the component absent.

outcome

Either "continuous" or "binary".

y

For a continuous outcome, the arm mean column.

se

For a continuous outcome, the arm standard error column. Supply this or both sd and n.

sd, n

For a continuous outcome, columns of arm standard deviation and sample size.

events, n_binary

For a binary outcome, event-count and sample-size columns.

ref

Optional column flagging exactly one within-study reference arm per study.

dstar

Optional named numeric vector of dose-normalisation references for the bilinear surface.

interactions

NULL, or a list of length-2 character vectors naming component pairs to model.

Value

An object of class cdt_data.

Examples

df <- data.frame(study = c("s1", "s1", "s1"), A = c(0, 1, 1),
                 B = c(0, 0, 1), y = c(0, -1, -2), se = c(1, 1, 1))
d <- cdt_data(df, study = "study", components = c("A", "B"),
              outcome = "continuous", y = "y", se = "se")
d

Read an Installed Package Data File

Description

Reads a CSV file installed with the package.

Usage

cdt_extdata(name)

Arguments

name

Filename under inst/extdata.

Value

A data frame.


Fit a Component Dose-Response Network Meta-Analysis

Description

Compiles the Stan model on first use and samples the posterior.

Usage

cdt_fit(data, interaction = c("bilinear", "none", "gpdi"),
  priors = cdt_priors(), newdata = NULL, backend = "auto", chains = 4,
  iter_warmup = 1000, iter_sampling = 1000, adapt_delta = 0.95,
  seed = 1, refresh = 0, ...)

Arguments

data

A cdt_data object.

interaction

Interaction surface: "bilinear", "none", or "gpdi".

priors

A named list from cdt_priors().

newdata

Optional data frame of component-dose combinations for Stan generated-quantities predictions.

backend

One of "auto", "cmdstanr", or "rstan".

chains, iter_warmup, iter_sampling

Sampler settings.

adapt_delta

Target acceptance probability passed to the Stan backend.

seed

Random seed.

refresh

Console refresh interval.

...

Passed to the backend sampler.

Details

The additive model uses interaction = "none". The bilinear model uses one interaction parameter per co-occurring component pair. The "gpdi" model uses a saturating surface adapted from the general pharmacodynamic interaction model.

Value

An object of class cdtmbnma.

Examples

sv <- sacval_example()
d <- cdt_data(sv, "study", c("d_sac", "d_val"), outcome = "continuous",
              y = "y", se = "se", dstar = c(d_sac = 200, d_val = 320))


# Fitting needs a Stan backend, and the Stan model is compiled on first use.
if (requireNamespace("rstan", quietly = TRUE)) {
  fit <- cdt_fit(d, interaction = "bilinear", backend = "rstan",
                 chains = 2, iter_warmup = 500, iter_sampling = 500)
  summary(fit)
}


Prior Settings for Single-Timepoint Models

Description

Creates prior hyperparameters for cdt_fit().

Usage

cdt_priors(emax_sd = 10, logED50_mean = log(50), logED50_sd = 1,
  int_sd = 5, ref_sd = 10, omega_sd = 2)

Arguments

emax_sd

Prior standard deviation for component Emax values.

logED50_mean, logED50_sd

Prior mean and standard deviation for log half-maximal dose values.

int_sd

Prior standard deviation for interaction parameters.

ref_sd

Prior standard deviation for per-study reference levels.

omega_sd

Half-normal prior scale for the random-effect standard deviation.

Value

A named list of prior hyperparameters.


Assemble a Two-Component Longitudinal Component-Dose Network

Description

Builds data for the two-component exponential time-course model.

Usage

cdt_time_data(data, study, arm, time, components, y, se = NULL,
  sd = NULL, n = NULL, ref = NULL, dstar = NULL)

Arguments

data

A long data frame with one row per study-arm-time observation.

study

Name of the study column.

arm

Name of the arm column.

time

Name of the follow-up time column.

components

Character vector naming exactly two component dose columns.

y, se

Outcome mean and standard error columns.

sd, n

Optional standard deviation and sample-size columns used to derive se.

ref

Optional column flagging the reference arm.

dstar

Optional named numeric vector of two dose-normalisation references.

Value

An object of class cdt_time_data.


Fit the Two-Component Component-Dose-Time Model

Description

Fits the stage-one longitudinal Stan model with an exponential time-course.

Usage

cdt_time_fit(data, priors = cdt_time_priors(), newdata = NULL,
  backend = "auto", chains = 4, iter_warmup = 1000,
  iter_sampling = 1000, adapt_delta = 0.95, seed = 1,
  refresh = 0, ...)

Arguments

data

A cdt_time_data object.

priors

A named list from cdt_time_priors().

newdata

Optional data frame of two-component dose combinations.

backend

One of "auto", "cmdstanr", or "rstan".

chains, iter_warmup, iter_sampling

Sampler settings.

adapt_delta

Target acceptance probability.

seed

Random seed.

refresh

Console refresh interval.

...

Passed to the backend sampler.

Value

An object of class cdt_timefit.


Prior Settings for the Two-Component Time-Course Model

Description

Creates prior hyperparameters for cdt_time_fit().

Usage

cdt_time_priors(ref_E_sd = 5, ref_lograte_mean = -3,
  ref_lograte_sd = 1, emax_sd = 10, logED50_mean = 0,
  logED50_sd = 1, eta_sd = 5, rate_sd = 1,
  omega_E_sd = 2, omega_k_sd = 0.5)

Arguments

ref_E_sd

Prior standard deviation for study-specific reference asymptotes.

ref_lograte_mean, ref_lograte_sd

Prior mean and standard deviation for study-specific reference log rates.

emax_sd

Prior standard deviation for component Emax values.

logED50_mean, logED50_sd

Prior mean and standard deviation for log half-maximal dose values.

eta_sd

Prior standard deviation for the bilinear interaction.

rate_sd

Prior standard deviation for component log-rate dose effects.

omega_E_sd, omega_k_sd

Half-normal prior scales for random-effect standard deviations.

Value

A named list of prior hyperparameters.


One-Call Component Dose-Response Network Meta-Analysis

Description

Convenience wrapper that builds the design with cdt_data() and fits it with cdt_fit().

Usage

cdtmbnma(data, study, components, outcome = c("continuous", "binary"),
  y = NULL, se = NULL, sd = NULL, n = NULL,
  events = NULL, n_binary = NULL, ref = NULL,
  dstar = NULL, interactions = NULL,
  interaction = c("bilinear", "none", "gpdi"),
  priors = cdt_priors(), newdata = NULL, backend = "auto", chains = 4,
  iter_warmup = 1000, iter_sampling = 1000, adapt_delta = 0.95,
  seed = 1, refresh = 0, ...)

Arguments

data, study, components, outcome, y, se, sd, n, events, n_binary, ref, dstar, interactions

Passed to cdt_data().

interaction, priors, newdata, backend, chains, iter_warmup, iter_sampling, adapt_delta, seed, refresh, ...

Passed to cdt_fit().

Value

An object of class cdtmbnma.

Examples


# Fitting needs a Stan backend, and the Stan model is compiled on first use.
if (requireNamespace("rstan", quietly = TRUE)) {
  fit <- cdtmbnma(sacval_example(), study = "study",
                  components = c("d_sac", "d_val"), outcome = "continuous",
                  y = "y", se = "se", backend = "rstan",
                  chains = 2, iter_warmup = 500, iter_sampling = 500)
  summary(fit)
}


Extract Long-Term Coefficients from a Time-Course Fit

Description

Extracts long-term component coefficient summaries.

Usage

## S3 method for class 'cdt_timefit'
coef(object, ...)

Arguments

object

A fitted cdt_timefit object.

...

Unused.

Value

A data frame with Emax and ED50 summaries for the two components.


Extract Component Coefficients

Description

Extracts component dose-response coefficient summaries.

Usage

## S3 method for class 'cdtmbnma'
coef(object, ...)

Arguments

object

A fitted cdtmbnma object.

...

Unused.

Value

A data frame with posterior summaries for component Emax and ED50 values.


COPD BGF Triple-Therapy Extraction Template

Description

Reads the package's COPD BGF extraction form or data dictionary.

Usage

copd_bgf_template(type = c("extraction", "dictionary"))

Arguments

type

Either "extraction" or "dictionary".

Value

A data frame.


Plot Component Dose-Response Curves

Description

Draws marginal component dose-response curves with posterior credible bands.

Usage

## S3 method for class 'cdtmbnma'
plot(x, ngrid = 60, probs = c(0.025, 0.975), ...)

Arguments

x

A fitted cdtmbnma object.

ngrid

Number of dose points per curve.

probs

Two quantiles for the credible band.

...

Passed to plot().

Value

Invisibly, a list of plotted grids.


Predict Long-Term Effects from a Time-Course Fit

Description

Computes long-term asymptotic relative effects for the stage-one longitudinal model.

Usage

## S3 method for class 'cdt_timefit'
predict(object, newdata, probs = c(0.025, 0.975), ...)

Arguments

object

A fitted cdt_timefit object.

newdata

Data frame carrying the two component-dose columns used in fitting.

probs

Quantiles for credible intervals.

...

Unused.

Value

A data frame with doses, posterior mean, posterior standard deviation, and requested quantiles.


Predict Relative Effects at Component-Dose Combinations

Description

Computes posterior relative effects against the all-zero reference at arbitrary component-dose combinations.

Usage

## S3 method for class 'cdtmbnma'
predict(object, newdata, probs = c(0.025, 0.975), ...)

Arguments

object

A fitted cdtmbnma object.

newdata

Data frame carrying the component dose columns used in fitting.

probs

Quantiles for credible intervals.

...

Unused.

Value

A data frame with doses, posterior mean, posterior standard deviation, and requested quantiles.


Sacubitril and Valsartan Blood-Pressure Dose Plane

Description

Reads the package's sacubitril/valsartan example data.

Usage

sacval_example()

Value

A data frame with columns study, arm, d_sac, d_val, n, y, sd, se, and sd_source.

Examples

head(sacval_example())

Summarise a Two-Component Time-Course Fit

Description

Summarises key structural parameters in a cdt_timefit object.

Usage

## S3 method for class 'cdt_timefit'
summary(object, ...)

Arguments

object

A fitted cdt_timefit object.

...

Unused.

Value

A data frame of posterior summaries and convergence diagnostics.


Summarise a cdtmbnma Fit

Description

Summarises the structural parameters of a cdtmbnma fit.

Usage

## S3 method for class 'cdtmbnma'
summary(object, ...)

Arguments

object

A fitted cdtmbnma object.

...

Unused.

Value

A data frame of posterior summaries and convergence diagnostics.