plotPredIntNormTestPowerCurve.Rd
Plot power vs. \(\Delta/\sigma\) (scaled minimal detectable difference) for a sampling design for a test based on a prediction interval for a normal distribution.
plotPredIntNormTestPowerCurve(n = 8, df = n - 1, n.mean = 1, k = 1,
range.delta.over.sigma = c(0, 5), pi.type = "upper", conf.level = 0.95,
plot.it = TRUE, add = FALSE, n.points = 20, plot.col = "black",
plot.lwd = 3 * par("cex"), plot.lty = 1, digits = .Options$digits, ...,
main = NULL, xlab = NULL, ylab = NULL, type = "l")
positive integer greater than 2 indicating the sample size upon which
the prediction interval is based. The default is value is n=8
.
positive integer indicating the degrees of freedom associated with
the sample size. The default value is df=n-1
.
positive integer specifying the sample size associated with the future average(s).
The default value is n.mean=1
(i.e., individual observations). Note that all
future averages must be based on the same sample size.
positive integer specifying the number of future observations that the
prediction interval should contain with confidence level conf.level
. The
default value is k=1
.
numeric vector of length 2 indicating the range of the x-variable to use for the
plot. The default value is range.delta.over.sigma=c(0,5)
.
character string indicating what kind of prediction interval to compute.
The possible values are pi.type="upper"
(the default), and
pi.type="lower"
.
numeric scalar between 0 and 1 indicating the confidence level of the
prediction interval. The default value is conf.level=0.95
.
a logical scalar indicating whether to create a plot or add to the existing plot
(see explanation of the argument add
below) on the current graphics device.
If plot.it=FALSE
, no plot is produced, but a list of (x,y) values is returned
(see the section VALUE). The default value is plot.it=TRUE
.
a logical scalar indicating whether to add the design plot to the existing plot (add=TRUE
),
or to create a plot from scratch (add=FALSE
). The default value is add=FALSE
.
This argument is ignored if plot.it=FALSE
.
a numeric scalar specifying how many (x,y) pairs to use to produce the plot.
There are n.points
x-values evenly spaced between range.x.var[1]
and range.x.var[2]
. The default value is n.points=100
.
a numeric scalar or character string determining the color of the plotted line or points. The default value
is plot.col="black"
. See the entry for col
in the help file for par
for more information.
a numeric scalar determining the width of the plotted line. The default value is
3*par("cex")
. See the entry for lwd
in the help file for par
for more information.
a numeric scalar determining the line type of the plotted line. The default value is
plot.lty=1
. See the entry for lty
in the help file for par
for more information.
a scalar indicating how many significant digits to print out on the plot. The default
value is the current setting of options("digits")
.
additional graphical parameters (see par
).
See the help file for predIntNormTestPower
for information on how to
compute the power of a hypothesis test for the difference between two means of
normal distributions based on a prediction interval for a normal distribution.
plotPredIntNormTestPowerCurve
invisibly returns a list with components:
x-coordinates of points that have been or would have been plotted.
y-coordinates of points that have been or would have been plotted.
See the help files for predIntNorm
and
predIntNormSimultaneous
.
See the help files for predIntNorm
and
predIntNormSimultaneous
.
In the course of designing a sampling program, an environmental scientist may wish
to determine the relationship between sample size, significance level, power, and
scaled difference if one of the objectives of the sampling program is to determine
whether two distributions differ from each other. The functions
predIntNormTestPower
and plotPredIntNormTestPowerCurve
can be
used to investigate these relationships for the case of normally-distributed
observations. In the case of a simple shift between the two means, the test based
on a prediction interval is not as powerful as the two-sample t-test. However, the
test based on a prediction interval is more efficient at detecting a shift in the
tail.
# Pages 6-16 to 6-17 of USEPA (2009) present EPA Reference Power Curves (ERPC)
# for groundwater monitoring:
#
# "Since effect sizes discussed in the next section often cannot or have not been
# quantified, the Unified Guidance recommends using the ERPC as a suitable basis
# of comparison for proposed testing procedures. Each reference power curve
# corresponds to one of three typical yearly statistical evaluation schedules -
# quarterly, semi-annual, or annual - and represents the cumulative power
# achievable during a single year at one well-constituent pair by a 99% upper
# (normal) prediction limit based on n = 10 background measurements and one new
# measurement from the compliance well.
#
# Here we will reproduce Figure 6-3 on page 6-17.
dev.new()
plotPredIntNormTestPowerCurve(n = 10, k = 1, conf.level = 0.99,
ylim = c(0, 1), main="")
plotPredIntNormTestPowerCurve(n = 10, k = 2, conf.level = 0.99,
add = TRUE, plot.col = "red", plot.lty = 2)
plotPredIntNormTestPowerCurve(n = 10, k = 4, conf.level = 0.99,
add = TRUE, plot.col = "blue", plot.lty = 3)
legend("topleft", c("Quarterly", "Semi-Annual", "Annual"), lty = 3:1,
lwd = 3 * par("cex"), col = c("blue", "red", "black"), bty = "n")
title(main = paste("Power vs. Delta/Sigma for Upper Prediction Interval with",
"n=10, Confidence=99%, and Various Sampling Frequencies", sep="\n"))
#==========
if (FALSE) { # \dontrun{
# Plot power vs. scaled minimal detectable difference for various sample sizes
# using a 5
dev.new()
plotPredIntNormTestPowerCurve(n = 8, k = 1, ylim = c(0, 1), main="")
plotPredIntNormTestPowerCurve(n = 16, k = 1, add = TRUE, plot.col = "red")
plotPredIntNormTestPowerCurve(n = 32, k = 1, add = TRUE, plot.col = "blue")
legend("bottomright", c("n=32", "n=16", "n=8"), lty = 1, lwd = 3 * par("cex"),
col = c("blue", "red", "black"), bty = "n")
title(main = paste("Power vs. Delta/Sigma for Upper Prediction Interval with",
"k=1, Confidence=95%, and Various Sample Sizes", sep="\n"))
#==========
# Clean up
#---------
graphics.off()
} # }