plotPredIntNormTestPowerCurve {EnvStats} R Documentation

## Power Curves for Sampling Design for Test Based on Prediction Interval for Normal Distribution

### Description

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.

### Usage

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


### Arguments

 n positive integer greater than 2 indicating the sample size upon which the prediction interval is based. The default is value is n=8. df positive integer indicating the degrees of freedom associated with the sample size. The default value is df=n-1. n.mean 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. k 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. range.delta.over.sigma 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). pi.type character string indicating what kind of prediction interval to compute. The possible values are pi.type="upper" (the default), and pi.type="lower". conf.level numeric scalar between 0 and 1 indicating the confidence level of the prediction interval. The default value is conf.level=0.95. plot.it 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. add 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. n.points 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. plot.col 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. plot.lwd 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. plot.lty 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. digits a scalar indicating how many significant digits to print out on the plot. The default value is the current setting of options("digits"). main, xlab, ylab, type, ... additional graphical parameters (see par).

### Details

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.

### Value

plotPredIntNormTestPowerCurve invisibly returns a list with components:

 x.var x-coordinates of points that have been or would have been plotted. y.var y-coordinates of points that have been or would have been plotted.

### Note

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.

### Author(s)

Steven P. Millard (EnvStats@ProbStatInfo.com)

### References

See the help files for predIntNorm and predIntNormSimultaneous.

predIntNorm, predIntNormK, predIntNormTestPower, predIntNormSimultaneous,
predIntNormSimultaneousK, predIntNormSimultaneousTestPower, Prediction Intervals, Normal.

### Examples

  # 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"))

#==========
## Not run:
# 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()

## End(Not run)


[Package EnvStats version 2.8.1 Index]