Last chance! 50% off unlimited learning
Sale ends in
Compute the power of a one-way fixed-effects analysis of variance, given the sample sizes, population means, population standard deviation, and significance level.
aovPower(n.vec, mu.vec = rep(0, length(n.vec)), sigma = 1, alpha = 0.05)
numeric vector of sample sizes for each group. The n.vec
denotes the sample size for group n.vec
must be at least 2,
and all elements of n.vec
must be greater than or equal to 2. Missing (NA
),
undefined (NaN
), and infinite (Inf
, -Inf
) values are not allowed.
numeric vector of population means. The length of mu.vec
must be the
same as the length of n.vec
. The default value is a vector of zeros.
Missing (NA
), undefined (NaN
), and infinite (Inf
, -Inf
)
values are not allowed.
numeric scalar specifying the population standard deviation (sigma=1
.
numeric scalar between 0 and 1 indicating the Type I error level associated
with the hypothesis test. The default value is alpha=0.05
.
a numeric scalar indicating the power of the one-way fixed-effects ANOVA for the given sample sizes, population means, population standard deviation, and significance level.
Consider
The power of this test, denoted by
The power of the one-way fixed-effects ANOVA depends on the
sample sizes for each of the
Berthouex, P.M., and L.C. Brown. (2002). Statistics for Environmental Engineers. Second Edition. Lewis Publishers, Boca Raton, FL.
Helsel, D.R., and R.M. Hirsch. (1992). Statistical Methods in Water Resources Research. Elsevier, New York, NY, Chapter 7.
Johnson, N. L., S. Kotz, and N. Balakrishnan. (1995). Continuous Univariate Distributions, Volume 2. Second Edition. John Wiley and Sons, New York, Chapters 27, 29, 30.
Millard, S.P., and Neerchal, N.K. (2001). Environmental Statistics with S-PLUS. CRC Press, Boca Raton, Florida.
Scheffe, H. (1959). The Analysis of Variance. John Wiley and Sons, New York, 477pp.
USEPA. (2009). Statistical Analysis of Groundwater Monitoring Data at RCRA Facilities, Unified Guidance. EPA 530/R-09-007, March 2009. Office of Resource Conservation and Recovery Program Implementation and Information Division. U.S. Environmental Protection Agency, Washington, D.C. p.6-38.
Zar, J.H. (2010). Biostatistical Analysis. Fifth Edition. Prentice-Hall, Upper Saddle River, NJ, Chapter 10.
aovN
, plotAovDesign
,
Normal
, aov
.
# NOT RUN {
# Look at how the power of a one-way ANOVA increases
# with increasing sample size:
aovPower(n.vec = rep(5, 3), mu.vec = c(10, 15, 20), sigma = 5)
#[1] 0.7015083
aovPower(n.vec = rep(10, 3), mu.vec = c(10, 15, 20), sigma = 5)
#[1] 0.9732551
#----------------------------------------------------------------
# Look at how the power of a one-way ANOVA increases
# with increasing variability in the population means:
aovPower(n.vec = rep(5,3), mu.vec = c(10, 10, 11), sigma=5)
#[1] 0.05795739
aovPower(n.vec = rep(5, 3), mu.vec = c(10, 10, 15), sigma = 5)
#[1] 0.2831863
aovPower(n.vec = rep(5, 3), mu.vec = c(10, 13, 15), sigma = 5)
#[1] 0.2236093
aovPower(n.vec = rep(5, 3), mu.vec = c(10, 15, 20), sigma = 5)
#[1] 0.7015083
#----------------------------------------------------------------
# Look at how the power of a one-way ANOVA increases
# with increasing values of Type I error:
aovPower(n.vec = rep(10,3), mu.vec = c(10, 12, 14),
sigma = 5, alpha = 0.001)
#[1] 0.02655785
aovPower(n.vec = rep(10,3), mu.vec = c(10, 12, 14),
sigma = 5, alpha = 0.01)
#[1] 0.1223527
aovPower(n.vec = rep(10,3), mu.vec = c(10, 12, 14),
sigma = 5, alpha = 0.05)
#[1] 0.3085313
aovPower(n.vec = rep(10,3), mu.vec = c(10, 12, 14),
sigma = 5, alpha = 0.1)
#[1] 0.4373292
#==========
# The example on pages 5-11 to 5-14 of USEPA (1989b) shows
# log-transformed concentrations of lead (mg/L) at two
# background wells and four compliance wells, where observations
# were taken once per month over four months (the data are
# stored in EPA.89b.loglead.df.) Assume the true mean levels
# at each well are 3.9, 3.9, 4.5, 4.5, 4.5, and 5, respectively.
# Compute the power of a one-way ANOVA to test for mean
# differences between wells. Use alpha=0.05, and assume the
# true standard deviation is equal to the one estimated from
# the data in this example.
# First look at the data
names(EPA.89b.loglead.df)
#[1] "LogLead" "Month" "Well" "Well.type"
dev.new()
stripChart(LogLead ~ Well, data = EPA.89b.loglead.df,
show.ci = FALSE, xlab = "Well Number",
ylab="Log [ Lead (ug/L) ]",
main="Lead Concentrations at Six Wells")
# Note: The assumption of a constant variance across
# all wells is suspect.
# Now perform the ANOVA and get the estimated sd
aov.list <- aov(LogLead ~ Well, data=EPA.89b.loglead.df)
summary(aov.list)
# Df Sum Sq Mean Sq F value Pr(>F)
#Well 5 5.7447 1.14895 3.3469 0.02599 *
#Residuals 18 6.1791 0.34328
#---
#Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 '' 1
# Now call the function aovPower
aovPower(n.vec = rep(4, 6),
mu.vec = c(3.9,3.9,4.5,4.5,4.5,5), sigma=sqrt(0.34))
#[1] 0.5523148
# Clean up
rm(aov.list)
# }
Run the code above in your browser using DataLab