-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.Rmd
146 lines (119 loc) · 5.51 KB
/
index.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
title: "Power Analysis with Superpower"
author:
- Aaron R. Caldwell
- Daniël Lakens
- Chelsea M. Parlett-Pelleriti
- Guy Prochilo
- Frederik Aust
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: book
bibliography: [book.bib, packages.bib, references.bib]
biblio-style: apalike
link-citations: yes
description: "This is a book describing the capabilities of the Superpower R package."
output:
bookdown::pdf_book:
keep_tex: yes
bookdown::tufte_book2:
keep_tex: yes
bookdown::gitbook:
config:
toc:
collapse: section
scroll_highlight: yes
before: null
after: null
---
```{tex}
```
This is a compilation of documents for [Superpower](https://github.com/arcaldwell49/Superpower) R package written in **Markdown** [@R-rmarkdown] and compiled by **Bookdown** [@R-bookdown].
```{r include=FALSE}
# automatically create a bib database for R packages
knitr::write_bib(c(
.packages(), 'bookdown', 'knitr', 'rmarkdown',
"pwr", "pwr2ppl",
"multcomp"
), 'packages.bib')
```
# 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 R.Version()$version.string`.
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](http://daniellakens.blogspot.com/2014/12/observed-power-and-what-to-do-if-your.html) is not a useful thing to do for single studies.
This package, and book, expect readers to have some familiarity with R [-@R-base]. However, we have created two Shiny apps (for the [`ANOVA_power`](https://arcaldwell49.github.io/project/shinypowerapp/) & [`ANOVA_exact`](https://arcaldwell49.github.io/project/shinyexactapp/) 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 @R-pwr2ppl and `pwr` by @R-pwr) and statistical programs (such as G*Power @faul2007g, MOREpower @Campbell2012MorePower6F, and SAS's `PROC GLMPOWER` -@SASglmpower). 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](https://github.com/arcaldwell49/Superpower/issues) repository. Issues with the book, should be raised on the book's [repository](https://github.com/arcaldwell49/SuperpowerBook/issues).
### Contributors {-}
- [Aaron R. Caldwell](https://aaroncaldwell.us)
- ORCID: https://orcid.org/0000-0002-4541-6283
- [Daniël Lakens](https://sites.google.com/site/lakens2/)
- ORCID: https://orcid.org/0000-0002-0247-239X
- [Chelsea M. Parlett-Pelleriti](https://cmparlettpelleriti.github.io/)
- [Guy Prochilo](http://www.guyprochilo.com/)
- ORCID: https://orcid.org/0000-0002-1544-3694
- [Frederik Aust](http://frederikaust.com/)
- ORCID: https://orcid.org/0000-0003-4900-788X
### 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.
```{r eval=FALSE, include=TRUE, echo=TRUE}
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)
```
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
#set number of simulations RESET BEFORE PUBLICATION TO 100.000
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) # Confidence intervals on standardized effect sizes / precision
library(grid) # Combining plots
library(GGally) # Beautiful plots
library(scales) # Improve axis ticks
library(here) # Smart directory manipulation
#latex_options = "hold_position"
```
```{r global_options, include=FALSE}
if(knitr::is_latex_output()){
options(knitr.table.format = "latex")
}
```