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)
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. doi: 10.3758/s13428-013-0330-5
### To estimate a mean x <- rnorm(500, mean=8, sd=3); pwr.bootES(data.frame(x=x), R=500, w=.5); #> [1] 126 ### 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); #> [1] 0.4679697 requiredN <- pwr.bootES(data.frame(x=x, y=y), effect.type='r', R=500, w=.2); print(requiredN); #> [1] 38 ### Compare to parametric confidence interval ### based on the computed required sample size confIntR(r = cor(x, y), N = requiredN); #> lo hi #> 0.467969731127448 0.1743729 0.6851528 #> attr(,"r") #> [1] 0.4679697 #> attr(,"N") #> [1] 38 #> attr(,"conf.level") #> [1] 0.95 ### WIdth of obtained confidence interval print(round(diff(as.numeric(confIntR(r = cor(x, y), N = requiredN))), 2)); #> [1] 0.51