R/plot_power.R
plot_power.Rd
Convenience function to plot power across a range of sample sizes.
plot_power(
design_result,
alpha_level = Superpower_options("alpha_level"),
min_n = 7,
max_n = 100,
desired_power = 90,
plot = Superpower_options("plot"),
emm = Superpower_options("emm"),
emm_model = Superpower_options("emm_model"),
contrast_type = Superpower_options("contrast_type"),
emm_comp,
verbose = Superpower_options("verbose"),
exact2 = FALSE,
liberal_lambda = Superpower_options("liberal_lambda")
)
Output from the ANOVA_design function
Alpha level used to determine statistical significance
Minimum sample size in power curve. Cannot be less than or equal to the product of factors. E.g., if design = "2b*2b" then min_n must be at least 5 (2\*2+1=5)
Maximum sample size in power curve.
Desired power (e.g., 80, 90). N per group will be highlighted to achieve this desired power in the plot. Defaults to 90.
Should power plot be printed automatically (defaults to TRUE)
Set to FALSE to not perform analysis of estimated marginal means
Set model type ("multivariate", or "univariate") for estimated marginal means
Select the type of comparison for the estimated marginal means
Set the comparisons for estimated marginal means comparisons. This is a factor name (a), combination of factor names (a+b), or for simple effects a | sign is needed (a|b)
Set to FALSE to not print results (default = TRUE)
Logical indicator for which ANOVA_exact
function (ANOVA_exact
or ANOVA_exact2
) to use in the plots. Default is FALSE which uses ANOVA_exact
which has sample size limitations.
Logical indicator of whether to use the liberal (cohen_f^2\*(num_df+den_df)) or conservative (cohen_f^2\*den_df) calculation of the noncentrality (lambda) parameter estimate. Default is FALSE.
Returns plot with power curves for the ANOVA, and a dataframe with the summary data.
"plot_ANOVA"
Plot of power curves from ANOVA results.
"plot_MANOVA"
Plot of power curves from MANOVA results. Returns NULL if no within-subject factors.
"plot_emm"
Plot of power curves from MANOVA results. Returns NULL if emm = FALSE.
"anova_n"
Achieved Power and Sample Size for ANOVA-level effects.
"manova_n"
Achieved Power and Sample Size for MANOVA-level effects.
"emm_n"
Achieved Power and Sample Size for estimated marginal means.
"power_df"
The tabulated ANOVA power results.
"power_df_manova"
The tabulated MANOVA power results. Returns NULL if no within-subject factors.
"power_df_emm"
The tabulated Estimated Marginal Means power results. Returns NULL if emm = FALSE.
"effect_sizes"
Effect sizes (partial eta-squared) from ANOVA results.
"effect_sizes_manova"
Effect sizes (Pillai's Trace) from MANOVA results. Returns NULL if no within-subject factors.
"effect_sizes_emm"
Effect sizes (cohen's f) estimated marginal means results. Returns NULL if emm = FALSE.
too be added
if (FALSE) {
design_result <- ANOVA_design(design = "3b",
n = 20,
mu = c(0,0,0.3),
sd = 1,
labelnames = c("condition",
"cheerful", "neutral", "sad"))
plot_power(design_result, min_n = 50, max_n = 70, desired_power = 90)
}