Creates the default contrast pattern for one ANOVA term and scales it so an exact reference dataset has the requested partial eta squared under the supplied balanced design assumptions.
Usage
design_term_means(
design,
term,
target_pes,
n,
sd = 1,
r = 0.5,
gpower = FALSE,
ss_type = "III"
)Arguments
- design
An
anovapowersim_design_specfrombalanced_anova_design().- term
Character scalar naming the ANOVA term to target. Interaction terms are order-insensitive.
- target_pes
Target partial eta squared.
- n
Sample size per between-subject cell. For pure within designs, this is the total sample size.
- sd
Common outcome standard deviation.
- r
Compound-symmetric correlation among within-subject cells.
- gpower
Logical; if
TRUE, calibrate to the G*Power-style noncentrality conventionlambda = total_n * f^2(using the 'as in Cohen (1988) option for within-subjects designs).- ss_type
Sums-of-squares type for the tested ANOVA term.
"III"is the default for order-invariant tests in unbalanced designs. Use"I"to reproduce sequentialstats::aov()tests.
Value
A numeric matrix of cell means, with rows indexing between cells and columns indexing within cells.
Examples
d <- balanced_anova_design(between = c(group = 2), within = c(time = 2))
design_term_means(d, term = "group:time", target_pes = 0.2, n = 20)
#> [,1] [,2]
#> [1,] 0.2436699 -0.2436699
#> [2,] -0.2436699 0.2436699