Creates the complete cell table used by power_unbalanced(). Each cell is
defined by its factor levels, sample size (n), and population mean (m).
End each cell after both reserved values have been supplied. The common
population standard deviation belongs in unbalanced_covariance().
Arguments
- ...
Repeated named cell definitions. Each cell must contain the same factor names in the same order, plus
nandm. Every factor must have at least 2 observed levels, and every combination of factor levels must appear exactly once (or be filled automatically; seedefault_n).- within
Character vector naming factors in
...that are measured within subjects, orNULLfor a purely between-subject design. Stored on the returned object and read bypower_unbalanced(). Within-cell names used byunbalanced_covariance()join level values with_; these names must be unique, and within-factor levels must not contain:.- default_n, default_m
Optional scalars used to fill any missing cells in the complete factorial design. Supply both to auto-fill missing cells with these values; supply none to require every cell to be defined explicitly (the default). Supplying only one is an error. When cells are auto-filled, a message reports their count and exact factor-level combinations so that unintended levels can be spotted.
Details
The m values are literal population cell means: their magnitudes and all
effects they contain are used as supplied. This differs from
means_pattern(), whose values specify only a relative shape that balanced
simulation functions project onto the tested term, normalize, and rescale
to target_pes.
Lifecycle
cell_design() is experimental and is available only in the development
version of anovapowersim. Its API may change.
See also
means_pattern() for shape-only patterns used by balanced
simulation functions.
Examples
design <- cell_design(
group = "control", time = "pre", n = 22, m = 10.0,
group = "control", time = "post", n = 22, m = 11.0,
group = "treatment", time = "pre", n = 31, m = 10.1,
group = "treatment", time = "post", n = 31, m = 12.4,
within = "time"
)
design
#> # A tibble: 4 × 4
#> group time n m
#> <chr> <chr> <int> <dbl>
#> 1 control pre 22 10
#> 2 control post 22 11
#> 3 treatment pre 31 10.1
#> 4 treatment post 31 12.4