# plot_power: Convenience function to plot power across a range of sample... In Superpower: Simulation-Based Power Analysis for Factorial Designs

 plot_power R Documentation

## Convenience function to plot power across a range of sample sizes.

### Description

Convenience function to plot power across a range of sample sizes.

### Usage

```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")
)
```

### Arguments

 `design_result` Output from the ANOVA_design function `alpha_level` Alpha level used to determine statistical significance `min_n` 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) `max_n` Maximum sample size in power curve. `desired_power` Desired power (e.g., 80, 90). N per group will be highlighted to achieve this desired power in the plot. Defaults to 90. `plot` Should power plot be printed automatically (defaults to TRUE) `emm` Set to FALSE to not perform analysis of estimated marginal means `emm_model` Set model type ("multivariate", or "univariate") for estimated marginal means `contrast_type` Select the type of comparison for the estimated marginal means `emm_comp` 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) `verbose` Set to FALSE to not print results (default = TRUE) `exact2` 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. `liberal_lambda` 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.

### Value

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.

### Examples

```## Not run:
design_result <- ANOVA_design(design = "3b",
n = 20,
mu = c(0,0,0.3),
sd = 1,
labelnames = c("condition",