power.anova.test
Power Calculations for Balanced One-Way Analysis of Variance Tests
Compute power of test or determine parameters to obtain target power.
- Keywords
- htest
Usage
power.anova.test(groups = NULL, n = NULL, between.var = NULL, within.var = NULL, sig.level = 0.05, power = NULL)
Arguments
- groups
- Number of groups
- n
- Number of observations (per group)
- between.var
- Between group variance
- within.var
- Within group variance
- sig.level
- Significance level (Type I error probability)
- power
- Power of test (1 minus Type II error probability)
Details
Exactly one of the parameters groups
, n
, between.var
,
power
, within.var
, and sig.level
must be passed as NULL,
and that parameter is determined from the others. Notice that
sig.level
has non-NULL default so NULL must be explicitly
passed if you want it computed.
Value
-
Object of class
"power.htest"
, a list of the arguments
(including the computed one) augmented with method
and
note
elements.
Note
uniroot
is used to solve power equation for unknowns, so
you may see errors from it, notably about inability to bracket the
root when invalid arguments are given.
See Also
Examples
library(stats)
power.anova.test(groups = 4, n = 5, between.var = 1, within.var = 3)
# Power = 0.3535594
power.anova.test(groups = 4, between.var = 1, within.var = 3,
power = .80)
# n = 11.92613
## Assume we have prior knowledge of the group means:
groupmeans <- c(120, 130, 140, 150)
power.anova.test(groups = length(groupmeans),
between.var = var(groupmeans),
within.var = 500, power = .90) # n = 15.18834
Community examples
Looks like there are no examples yet.