ufs (version 0.3.2)

pwr.bootES: Estimate required sample size for accuracy in parameter estimation using bootES

Description

This function uses bootES::bootES() to compute

Usage

pwr.bootES(data = data, ci.type = "bca", ..., w = 0.1, silent = TRUE)

Arguments

data

The dataset, as you would normally supply to bootES::bootES(); you will probably have to simulate this.

ci.type

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).

w

The desired 'halfwidth' of the confidence interval.

silent

Whether to provide a lot of information about progress ('FALSE') or not ('TRUE').

Value

A single numeric value (the sample size).

References

Kirby, K. N., & Gerlanc, D. (2013). BootES: An R package for bootstrap confidence intervals on effect sizes. Behavior Research Methods, 45, 905<U+2013>927. 10.3758/s13428-013-0330-5

Examples

Run this code
# NOT RUN {
### 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));
# }

Run the code above in your browser using DataLab