# Preface

This book is still being developed. If you have any comments to improve this book, let us know.

This book was compiled with R version 4.0.3 (2020-10-10).

The goal of Superpower is to easily simulate factorial designs and empirically calculate power using a simulation approach. The R package is intended to be utilized for prospective (a priori) power analysis. Calculating post hoc power is not a useful thing to do for single studies.

This package, and book, expect readers to have some familiarity with R (2020). However, we have created two Shiny apps (for the ANOVA_power & ANOVA_exact functions respectively) to help use Superpower if you are not familiar with R. Reading through the examples in this book, and reproducing them in the Shiny apps, is probably the easiest way to get started with power analyses in Superpower.

In this book we will display a variety of ways the Superpower package can be used for power analysis and sample size planning for factorial experimental designs. We also included various examples of the performance of Superpower against other R packages (e.g., pwr2ppl by and pwr by ) and statistical programs (such as G*Power , MOREpower , and SAS’s PROC GLMPOWER (2015)). All uses of the ANOVA_power function have been run with 10000 iterations (nsims = 10000). If you have any issues using Superpower or want to expand its capabilities please raise the issue on our GitHub repository. Issues with the book, should be raised on the book’s repository.

### Contributions

ARC and DL wrote the majority of this book together when creating the Superpower R package. Initially, these were meant to be validation documents to show that Superpower worked as intended, but later decided to convert this into a teaching tool. CMPP was hired in 2019 to aide in compiling this book and was instrumental in editing/fact checking early versions of the book. GP wrote the majority of the first chapter as part of a instructional manual to his students and was kind enough to share a version to be included in this book. FA, creator of the emmeans_power function in Superpower, wrote an early version of the emmeans chapter which serves as the vignette in the package.

### Funding

This work was funded by VIDI Grant 452-17-013 from the Netherlands Organisation for Scientific Research.

## Settings

The following packages and settings are necessary to reproduce the output in this package.

nsims <- 10000
library(mvtnorm)
library(MASS)
library(afex)
library(emmeans)
library(gridExtra)
library(reshape2)
library(pwr)
library(pwr2ppl)
library(lsr)
library(viridis)
library(broom)
library(car)
library(tidyverse)
library(Superpower)
library(knitr)
library(kableExtra)
library(MBESS)
library(grid)
library(GGally)
library(scales)
library(here)
library(data.table) 

### References

Aberson, Chris. 2020. Pwr2ppl: Power Analyses for Common Designs (Power to the People). https://CRAN.R-project.org/package=pwr2ppl.
Campbell, Jamie, and Valerie A. Thompson. 2012. “MorePower 6.0 for ANOVA with Relational Confidence Intervals and Bayesian Analysis.” Behavior Research Methods 44: 1255–65. https://doi.org/10.3758/s13428-012-0186-0.
Champely, Stephane. 2020. Pwr: Basic Functions for Power Analysis. https://github.com/heliosdrm/pwr.
Faul, Franz, Edgar Erdfelder, Albert-Georg Lang, and Axel Buchner. 2007. “G*power 3: A Flexible Statistical Power Analysis Program for the Social, Behavioral, and Biomedical Sciences.” Behavior Research Methods 39 (2): 175–91. http://www.psychologie.hhu.de/arbeitsgruppen/allgemeine-psychologie-und-arbeitspsychologie/gpower.html.
R Core Team. 2020. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
SAS. 2015. “The GLMPOWER Procedure.” In SAS/STAT 14.1 User’s Guide, 3738–98. Cary, NC: SAS Institute Inc. http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_glmpower_toc.htm.