pwr.bootES | R Documentation |
This function uses bootES::bootES()
to compute
pwr.bootES(data = data, ci.type = "bca", ..., w = 0.1, silent = TRUE)
data |
The dataset, as you would normally supply to |
ci.type |
The estimation method; by default, the default of
|
... |
Other options for |
w |
The desired 'halfwidth' of the confidence interval. |
silent |
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. \Sexpr[results=rd]{tools:::Rd_expr_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));
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.