
CAMS subgroup and overall effects on an information-fraction grid
Source:R/contribution.R
predict_cams_by_if.RdEvaluates the fitted CAMS posterior at a grid of information fractions
without refitting. Each posterior row already stores the joint pairing of
\((\alpha,\beta_m)\) (overall block) with the independent interaction
draw \(\gamma\). For draw \(s\) and grid value \(\pi_k\) (Panaro et al.,
2025, Eq. 3.10–3.11):
$$m^{(s)}(\pi_k)=\alpha^{(s)}+\beta_m^{(s)}\pi_k,$$
$$\mu_A^{(s)}(\pi_k)=\alpha^{(s)}+\delta^{(s)}\pi_k,$$
$$\mu_B^{(s)}(\pi_k)=\alpha^{(s)}+\delta^{(s)}\pi_k+\gamma^{(s)},$$
with \(\delta^{(s)}=\beta_m^{(s)}-\gamma^{(s)}\) stored as b_ifrac.
Stored b_Intercept is \(\alpha\), b_subgroup* is \(\gamma\). Subgroup
lines are parallel with vertical gap \(\gamma\).
Usage
predict_cams_by_if(
fit,
if_grid = NULL,
level = 0.95,
ifrac_var = NULL,
resolution = 200,
max_support = NULL,
exponentiate = FALSE,
interval.type = NULL,
reference = NULL
)Arguments
- fit
A
interactmetafromcams().- if_grid
Numeric information-fraction grid. If
NULL, spans the observed study IF range with a small margin (seeplot_contribution()).- level
Coverage probability for
lower/upper(default0.95).- ifrac_var
IF_*design column used to build the default grid.- resolution
Grid length when
if_gridisNULL.- max_support
Optional cap on unweighted posterior rows. Rejected for Bayesian CAMS DIRECT supports; omit it.
- exponentiate
If
TRUE, summarize on the exponential scale.- interval.type
"central"or"shortest"mixture interval on Bayesian DIRECT nodes (default:fit$interval.type, usually"central"). Pass"shortest"for the narrowest equal-probability interval.- reference
Optional label of the reference subgroup (A) to report against.
NULL(default) keeps the reference used incams(). 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\), andat_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 withcams(..., 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.
Value
A data frame with one row per grid point and modifier level:
ifrac (IF of the non-reference subgroup), level, estimate, lower,
upper, plus
overall_estimate, overall_lower, overall_upper for
\(m(\pi)=\alpha+\beta_m\pi\) at that grid point.
Details
Pointwise estimate / lower / upper use mixture intervals from the
DIRECT-node Gaussian mixture (weights .weight, within-node SDs
.cond_*). Alpha and beta_m stay on the joint overall-block support
(never convolved with each other).