Skip to contents

Use as at_ifrac in modifiers(), combined(), and interactions() to average marginal effects over an uncertain combined-population reporting fraction \(\pi^\star\) while keeping a single \(\pi^\star\) on each CAMS mixture evaluation (outer draws) and the usual \(\tau\) support grid inside each evaluation (inner nodes in fit$support).

Usage

reporting_if_draws(n, fun = NULL, shape1 = 5, shape2 = 7, seed = NULL)

Arguments

n

Number of outer Monte Carlo draws of \(\pi^\star\).

fun

Optional function of n returning values in [0, 1]. When NULL, draws from stats::rbeta(n, shape1, shape2).

shape1, shape2

Beta shape parameters when fun is NULL.

seed

Optional integer; forwarded to set.seed() before sampling.

Value

An object of class interactmeta_reporting_if_draws (length n via length(), values in $values).

Details

This is not the same as passing stats::rbeta(B, …) with length(B) \neq nrow(fit$support): that length is reserved for assigning different \(\pi^\star\) to each inner node in one pass.

Relation to at_ifrac = NULL and ifrac()

With at_ifrac = NULL, modifiers() takes \(\omega\) from ifrac() on the fitted object (ifrac = "interaction" or "combined"). Because \(\tau\) and \(\tau_\gamma\) vary across fit$support, pooled \(\omega\) is a distribution on the quadrature grid; that path already mixes effects with .weight (exact for the DIRECT posterior). Use that default when fit-based \(\pi^\star\) is enough.

reporting_if_draws() adds outer Monte Carlo over a user distribution on reporting \(\pi^\star\) (e.g. \(\mathrm{Beta}(5,7)\)). fit_reporting_if_draws() uses the same outer API with \(\omega\) drawn via ifrac(..., tau_sampling = "posterior") (marginal \(\tau\) MC) for each outer row.

See also

modifiers() at_ifrac

Examples

if (FALSE) { # \dontrun{
fit <- cams(x, reference = "A", method = "Bayesian")
m <- modifiers(fit, at_ifrac = reporting_if_draws(500, shape1 = 5, shape2 = 7))
coef(m)
} # }