Learn R Programming

powerbrmsINLA (version 1.1.1)

decide_sample_size: Decide recommended sample size from power/assurance results

Description

Returns the smallest n per effect setting that meets user-specified targets. Works with both brms_inla_power() and brms_inla_power_sequential() outputs.

Usage

decide_sample_size(
  x,
  direction = NULL,
  threshold = NULL,
  rope_in = NULL,
  bf10 = NULL,
  bf_prop_min = 0,
  targets = NULL
)

Value

A data.frame with recommended n per effect combination and the rationale.

Arguments

x

A list with $summary (engine output) or a data.frame summary itself.

direction

Numeric in \([0, 1]\), required power for power_direction (optional).

threshold

Numeric in \([0, 1]\), required power for power_threshold (optional).

rope_in

Numeric in \([0, 1]\), maximum allowed Pr(in ROPE) (optional). Note: since summaries usually contain power_rope = Pr(outside ROPE) >= prob_threshold, we compare (1 - power_rope) <= rope_in when rope_in is given.

bf10

Numeric Bayes-factor cutoff (e.g., 10). If provided, we look for a column named bf_hit_<bf10>; if not found, we fall back to any bf_hit_* column present.

bf_prop_min

Numeric in \([0, 1]\), the minimum proportion of simulations that must achieve BF >= bf10 (default 0).

targets

Optional list alternative to the direct args. Ignored if any direct arg is non-NULL.

Details

You can pass targets directly via arguments (direction, threshold, rope_in, bf10) or via targets = list(direction=..., threshold=..., rope_in=..., bf10=...). Direct arguments take precedence if supplied.