Description Usage Arguments Details Value See Also Examples
View source: R/boot.power.anova.R
This function bootstraps the power of each effect in an ANOVA design for a given range
of sample sizes. Power is computed by randomly drawing samples from a multivariate normal
distribution specified according to the values supplied by the design.anova
object. Power is defined as the proportion of bootstrap iterations the p-values of each
effect lie below the supplied alpha level. Note that this function runs many ANOVAs which
might be slow for large sample size ranges or bootstrap iterations (see Details below).
Further note that this function does not check for assumptions such as sphericity.
1 | boot.power.anova(design, n_from, n_to, num_iterations_bootstrap, alpha = 0.05)
|
design |
object of type |
n_from |
numeric, lower boundary of sample size range (inclusive) ; Refers to N per between condition |
n_to |
numeric, upper boundary of sample size range (inclusive) ; Refers to N per between condition |
num_iterations_bootstrap |
numeric, number of bootstrap iterations for each sample size |
alpha |
numeric, alpha level |
Note that this function requires the computation of many ANOVAs and therefore becomes slow with increasing sample size ranges and bootstrap iterations. It is therefore suggested to first use a very low number of bootstrap iterations, such as 10, in order to determine a sensible sample size range for the power of interest. Once done, use this small sample size range and dramatically increase the bootstrap iterations, such as 3000, in order to determine more reliable power estimates. Because the power-by-samplesize function is monotonically increasing, a zigzag of power values with increasing sample sizes indicates that the selected bootstrap iterations are too low.
list containing power-by-samplesize data.frames for each effect
design.anova
, plot.power_by_samplesize
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
design <- design.anova(
between = list(age = c("young","old"),
sex = c("male","female")),
within = list(condition = c("cond1","cond2","cond3")),
default_within_correlation = 0.7
)
power_by_samplesize <- boot.power.anova(
design,
n_from = 40,
n_to = 60,
num_iterations_bootstrap = 1000
)
plot(power_by_samplesize,
crit_power = 0.9,
plot_dir = "power_plots")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.