Skip to contents

Evaluates CAMS modifier-specific treatment effects at the pooled (precision-weighted) information fraction from ifrac(). Vignettes often use published subgroup tables (IMV/Non-IMV, age strata, …); the same extractor applies whenever each trial contributes one estimate per modifier level (long format). The modifier column defaults to "level"; pass modifier = on cams() to use another column name. Display headings capitalize the first letter of that column name.

Usage

modifiers(
  fit,
  at_ifrac = NULL,
  at = NULL,
  ifrac = NULL,
  type = c("Overall", "Prediction"),
  prob = NULL,
  max_support = NULL,
  summary = TRUE,
  contrast_sep = NULL,
  exponentiate = NULL,
  shrinkage = FALSE,
  contribution = NULL,
  reference = NULL,
  .rpi_scalar_ok = FALSE
)

Arguments

fit

A interactmeta from cams().

at_ifrac

Combined-population reporting information fraction (\(\pi^\star\)). If NULL (default), pools via ifrac() with ifrac (default "interaction"). Use at_ifrac = "interaction" or "combined" for the same. A scalar in [0, 1] is a plug-in; a numeric vector (one value per support row) assigns different \(\pi^\star\) to each inner mixture node (unusual). To average over a distribution of \(\pi^\star\) (outer draws \(\times\) inner nrow(fit$support) grid), use reporting_if_draws() as at_ifrac, e.g. at_ifrac = reporting_if_draws(1000, shape1 = 5, shape2 = 7). REML / ML: pooled modes or a scalar only.

at

Deprecated alias of at_ifrac.

ifrac

Pooling weights when at_ifrac is taken from the fit; must agree with a character at_ifrac if both are set.

type

One or both of "Overall" and "Prediction". "Overall" uses fixed effects only; "Prediction" adds a new-trial random effect drawn from the posterior trial SDs at the combined-population IF (effect in a new trial).

prob

Coverage probability for lci / uci when summary = TRUE.

max_support

Optional cap on unweighted posterior rows. Rejected for Bayesian CAMS DIRECT supports (weighted quadrature nodes); omit it.

summary

If TRUE (default), include a summary data frame.

contrast_sep

Rows whose subgroup label contains this separator are excluded when resolving subgroup levels (default "-").

exponentiate

If TRUE, transform posterior draws with exp() before summarizing (e.g. log rate ratios to ratios).

shrinkage

If TRUE, delegate to shrinkage() with type = "modifiers" (trial-specific reconstruction at each trial's \(\pi_j\)). If FALSE (default), return only Overall / Prediction at the combined-population information fraction.

contribution

Deprecated; use at_ifrac.

reference

Optional label of the reference subgroup (A) to report against. NULL (default) keeps the reference used in cams(). Naming the stored non-reference subgroup re-expresses the existing fit without refitting (two subgroups only): information fractions become \(1-\pi\) (trial \(\pi_j\), pooled \(\omega\), and at_ifrac, which is read on the requested orientation), interactions change sign (\(g_j \rightarrow -g_j\), \(\gamma \rightarrow -\gamma\)) and contrast labels swap; modifier-level and combined-population effects are unchanged. Frequentist (REML / ML) results equal a refit with cams(..., reference = ). Bayesian results can differ slightly from such a refit because the default normal prior on \((\alpha,\beta_m)\) is not invariant to this reparameterization.

.rpi_scalar_ok

Internal. When TRUE, allows a scalar at_ifrac with reporting_if_draws()-style outer averaging. End users should omit this argument.

Value

A interactmeta_subgroup_effects object (list with support, summary, overall_ifrac, overall_ifrac_source ("fit" or "user"), ifrac, reference, prob, exponentiate, modifier). support holds the long draws (columns level, type, effect, plus DIRECT weights for Bayesian fits). summary has one row per level and type with estimate (posterior median), mean, sd, lci, uci, and prob, on the exponentiated scale when exponentiate = TRUE. For Bayesian CAMS, lci/uci are credible intervals following fit$interval.type (default central) on the DIRECT-node mixture. For frequentist CAMS, estimate equals mean and lci/uci are Wald intervals from the plug-in estimates.

Details

This is not a marginal treatment effect in the survey-sampling sense: it is the modifier-level linear predictor at the combined-population contribution structure \(\widetilde{\pi}\).

For each posterior draw, the linear predictor is evaluated at that draw's combined-population information fraction with the appropriate subgroup fixed effect: $$\mu_A(\pi^\star)=\alpha+\pi^\star\delta,$$ $$\mu_B(\pi^\star)=\alpha+\pi^\star\delta+\gamma,$$ with \(\delta=\beta_m-\gamma\) on each support row (b_ifrac). This is not the trial-specific convolution on fit$latent$mu_A[[j]] / fit$latent$mu_B[[j]] (\(\mu_{Aj}=m_j-\pi_j g_j\) at that trial's \(\pi_j\)). A scalar at_ifrac is a plug-in \(\pi^\star\); NULL uses the default ifrac() grid on fit$support (weighted inner mixture).

\(\alpha\) and \(\beta_m\) share the overall-block support. Population \(m^\star=\alpha+\pi^\star\beta_m\) is formed from that joint (\(\beta_m=\delta+\gamma\)), not by convolving the two mixture marginals.

Bayesian support and uncertainty layers

For Bayesian CAMS, fit$support has nrow(fit$support) rows: a DIRECT quadrature grid, not MCMC samples. Each row is one pair of heterogeneity nodes from the overall block (sd_trial__Intercept, \(\tau\)) and the interaction block (sd_trial__ifrac2_*, \(\tau_\gamma\)) with mixture weight .weight (see interactmeta_bayesmeta_draws_from_support()).

Inner (default) averaging — at_ifrac = NULL: modifiers() pools at one \(\bar\omega(\tau^{(k)})\) per DIRECT support row (ifrac(fit) with tau_sampling = "grid", default) and mixes inner coefficient draws with .weight. Pass ifrac(fit, tau_sampling = "posterior") for optional marginal-\(\tau\) Monte Carlo on the pooled IF alone. Character at_ifrac = "interaction" / "combined" is only shorthand for this (same as NULL with matching ifrac), not a separate Monte Carlo mechanism.

Outer averaging — user \(\pi^\star\): reporting_if_draws() adds draws from an exogenous distribution on reporting \(\pi^\star\) (e.g. \(\mathrm{Beta}(5,7)\)), on top of the inner grid (\(B \times n\) rows with n = nrow(fit$support)).