Skip to contents

This article follows vignette("cams"). CAMS treats combined-effect heterogeneity τ\tau and interaction heterogeneity τγ\tau_\gamma as separate blocks. heterogeneity() tabulates them; plot(fit, type = "heterogeneity") draws Bayesian marginals or frequentist profile views. traceplot() applies only to Bayesian fits (bayesmeta shrinkage-vs-τ\tau panels for the interaction and combined blocks).

library(interactmeta)

des_age <- ifrac(age, reference = "Younger")
fit_age <- cams(
  des_age,
  reference = "Younger",
  tau.prior = function(tau) bayesmeta::dhalfnormal(tau, scale = 0.5),
  tau.interaction.prior = function(tau_gamma)
    bayesmeta::dhalfnormal(tau_gamma, scale = 0.1)
)

Half-normal tau.prior and tau.interaction.prior follow the immunotherapy example in vignette("cams"); use method = "REML" on the same ifrac() output when you only need frequentist heterogeneity panels.

Bayesian heterogeneity and traceplots (age)

heterogeneity(fit_age)
#> Between-trial heterogeneity (trial SD parameters)
#> parameter          type       estimate    se  Overall 95% CI
#> Combined           intercept      0.30  0.13    (0.14, 0.65)
#> Interaction_Older  slope          0.09  0.07    (0.00, 0.25)
summary(fit_age)$heterogeneity$summary
#> # A tibble: 2 × 9
#>   parameter         type      estimate   mean     sd     lci   uci  prob label  
#>   <chr>             <chr>        <dbl>  <dbl>  <dbl>   <dbl> <dbl> <dbl> <chr>  
#> 1 Combined          intercept   0.296  0.322  0.132  0.140   0.652  0.95 Hetero…
#> 2 Interaction_Older slope       0.0908 0.0999 0.0675 0.00448 0.250  0.95 Intera…

heterogeneity() defaults to component = "all" with summary = TRUE. Request component = "intercept" or "slope" for one CAMS block, set prob for interval coverage, or summary = FALSE to keep only the support element (no summary table). summary() exposes the same rows in $heterogeneity$summary.

plot(fit_age, type = "heterogeneity")

plot(fit, type = "heterogeneity") calls plot_heterogeneity() with which = "both" (τ and τ_γ side by side). On REML fits with τ̂ at the boundary, panels show metafor profiles rather than sharp posteriors. Use which = "interaction" or "combined" for a single panel; prior = TRUE overlays the stored τ prior on Bayesian plots. See [?plot_heterogeneity] for ggplot fallbacks (probs, bins, colours, base_size).

Traceplots (age)

traceplot(fit_age, type = "interaction")

traceplot(fit_age, type = "combined")

[?traceplot] documents ylab, xlab, and bayesmeta passthrough (mulim, taulim, ci, prior, colours). type = "modifiers" is intentionally unsupported: orthogonal CAMS stores interaction and combined native objects only. traceplot() requires method = "Bayesian" on cams().

Frequentist heterogeneity plot (steroids)

The REACT steroids REML fit from vignette("cams") often estimates τ\tau and τγ\tau_\gamma at zero; the heterogeneity panel then reflects the fitted metafor random-effects structure rather than an informative profile.

library(metafor)
#> Loading required package: Matrix
#> Loading required package: metadat
#> Loading required package: numDeriv
#> 
#> Loading the 'metafor' package (version 5.2-1). For an
#> introduction to the package please type: help(metafor)

steroids_es <- escalc(
  measure = "OR",
  ai = treat.events, bi = treat.total - treat.events,
  ci = cont.events, di = cont.total - cont.events,
  data = steroids
)
des_st <- ifrac(steroids_es, reference = "Non-IMV")
fit_reml <- cams(des_st, reference = "Non-IMV", method = "REML")
heterogeneity(fit_reml)
#> Between-trial heterogeneity (trial SD parameters)
#> parameter        type       estimate  Overall 95% CI
#> Combined         intercept      0.00    (0.00, 1.25)
#> Interaction_IMV  slope          0.00    (0.00, 0.00)
plot(fit_reml, type = "heterogeneity")

The REML table uses the same heterogeneity() API as the Bayesian age fit; plot(fit_reml, type = "heterogeneity", ...) forwards prob and which to plot_heterogeneity(). Profile shading and cutoff labels follow the fitted metafor rma blocks when τ is estimated at zero.