Calculates analytic sample sizes for a two-arm study. Likert items use the
standard deviation of score. Choice items use the share of a focal response
or, when appropriate, the modal response. Open items are omitted.
Arguments
- responses
A
panel_administer()result (the silicon pilot).- effect
Raw minimum detectable difference between the two arms: scale points for Likert items, a difference in proportions for choice items. A scalar (recycled) or a named vector keyed by
item_id.- items
Optional character vector restricting which items to include.
- focal
Optional named character vector keyed by
item_id, giving the focal response level whose proportion the power calculation should target. For a binary choice item the modal option is a well-defined estimand andfocalis optional; for a choice item with three or more options the "modal share" is not a meaningful single proportion, so name the focal response here. Without afocalfor a 3+-option item, the modal share is used and a warning is issued. A named focal that the pilot never elicited is still powered: as long as it is one of the item's options, the observed rate is taken as 0 (with a warning) rather than an error; only a focal that is not an offered option of the item is rejected.- alpha
Two-sided test size.
- power
Target power.
Value
A tibble: item_id, type, dispersion (sd for Likert, the focal
or modal share for choice), effect, n_per_arm.
Examples
if (FALSE) { # \dontrun{
set.seed(110)
panel <- panel_from_margins(list(group = c(A = .5, B = .5)), n = 8)
instrument <- panel_instrument(list(
item_likert("lik", "Rate the proposal.", scale = c("low", "mid", "high")),
item_choice("pick", "Pick one.", c("A", "B"))),
randomize = character(0))
cfg <- LLMR::llm_config("groq", "openai/gpt-oss-20b")
r <- panel_administer(panel, instrument, cfg)
panel_power(r, effect = c(lik = 0.5, pick = 0.2))
} # }