R/pwr.bootES.R
pwr.bootES.Rd
This function uses bootES::bootES()
to compute
pwr.bootES(data = data, ci.type = "bca", ..., w = 0.1, silent = TRUE)
The dataset, as you would normally supply to bootES::bootES()
;
you will probably have to simulate this.
The estimation method; by default, the default of
bootES::bootES()
is used ('bca'), but this is changed to 'basic' if it
encounters problems.
Other options for bootES::bootES()
(see that help page).
The desired 'halfwidth' of the confidence interval.
Whether to provide a lot of information about progress ('FALSE') or not ('TRUE').
A single numeric value (the sample size).
Kirby, K. N., & Gerlanc, D. (2013). BootES: An R package for bootstrap confidence intervals on effect sizes. Behavior Research Methods, 45, 905–927. doi: 10.3758/s13428-013-0330-5
### This requires the bootES package
if (requireNamespace("bootES", quietly = TRUE)) {
### To estimate a mean
x <- rnorm(500, mean=8, sd=3);
pwr.bootES(data.frame(x=x),
R=500,
w=.5);
### To estimate a correlation (the 'effect.type' parameter is
### redundant here; with two columns in the data frame, computing
### the confidence interval for the Pearson correlation is the default
### ehavior of bootES)
y <- x+rnorm(500, mean=0, sd=5);
cor(x, y);
requiredN <-
pwr.bootES(data.frame(x=x,
y=y),
effect.type='r',
R=500,
w=.2);
print(requiredN);
### Compare to parametric confidence interval
### based on the computed required sample size
confIntR(r = cor(x, y),
N = requiredN);
### Width of obtained confidence interval
print(round(diff(as.numeric(confIntR(r = cor(x, y),
N = requiredN))), 2));
}