Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/plotPredIntNparSimultaneousTestPowerCurve.R
Plot power vs. Δ/σ (scaled minimal detectable difference) for a sampling design for a test based on a nonparametric simultaneous prediction interval. The power is based on assuming the true distribution of the observations is normal.
1 2 3 4 5 6 7 8  plotPredIntNparSimultaneousTestPowerCurve(n = 8, n.median = 1, k = 1, m = 2,
r = 1, rule = "k.of.m", lpl.rank = ifelse(pi.type == "upper", 0, 1),
n.plus.one.minus.upl.rank = ifelse(pi.type == "lower", 0, 1), pi.type = "upper",
r.shifted = r, integrate.args.list = NULL, method = "approx", NMC = 100,
range.delta.over.sigma = c(0, 5), plot.it = TRUE, add = FALSE, n.points = 20,
plot.col = "black", plot.lwd = 3 * par("cex"), plot.lty = 1,
digits = .Options$digits, cex.main = par("cex"), ..., main = NULL,
xlab = NULL, ylab = NULL, type = "l")

n 
positive integer specifying the sample sizes. 
n.median 
positive odd integer specifying the sample size associated with the
future medians. The default value is 
k 
for the kofm rule ( 
m 
positive integer specifying the maximum number of future observations (or
medians) on one future sampling “occasion”.
The default value is 
r 
positive integer specifying the number of future sampling
“occasions”. The default value is 
rule 
character string specifying which rule to use. The possible values are

lpl.rank 
nonnegative integer indicating the rank of the order statistic to use for
the lower bound of the prediction interval. When 
n.plus.one.minus.upl.rank 
nonnegative integer related to the rank of the order statistic to use for
the upper
bound of the prediction interval. A value of 
pi.type 
character string indicating what kind of prediction interval to compute.
The possible values are 
r.shifted 
integer between 
integrate.args.list 
list of arguments to supply to the 
method 
character string indicating what method to use to compute the power. The possible
values are 
NMC 
positive integer indicating the number of Monte Carlo trials to run when 
range.delta.over.sigma 
numeric vector of length 2 indicating the range of the xvariable to use for the
plot. The default value is 
plot.it 
a logical scalar indicating whether to create a plot or add to the existing plot
(see explanation of the argument 
add 
a logical scalar indicating whether to add the design plot to the existing plot ( 
n.points 
a numeric scalar specifying how many (x,y) pairs to use to produce the plot.
There are 
plot.col 
a numeric scalar or character string determining the color of the plotted line or points. The default value
is 
plot.lwd 
a numeric scalar determining the width of the plotted line. The default value is

plot.lty 
a numeric scalar determining the line type of the plotted line. The default value is

digits 
a scalar indicating how many significant digits to print out on the plot. The default
value is the current setting of 
cex.main, main, xlab, ylab, type, ... 
additional graphical parameters (see 
See the help file for predIntNparSimultaneousTestPower
for
information on how to compute the power of a hypothesis test for the difference
between two means of normal distributions based on a nonparametric simultaneous
prediction interval.
plotPredIntNparSimultaneousTestPowerCurve
invisibly returns a list with
components:
x.var 
xcoordinates of points that have been or would have been plotted. 
y.var 
ycoordinates of points that have been or would have been plotted. 
See the help file for predIntNparSimultaneous
.
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
predIntNparSimultaneousTestPower
and
plotPredIntNparSimultaneousTestPowerCurve
can be
used to investigate these relationships for the case of normallydistributed
observations.
Steven P. Millard (EnvStats@ProbStatInfo.com)
See the help file for predIntNparSimultaneous
.
Gansecki, M. (2009). Using the Optimal Rank Values Calculator. US Environmental Protection Agency, Region 8, March 10, 2009.
predIntNparSimultaneousTestPower
,
predIntNparSimultaneous
,
predIntNparSimultaneousN
,
predIntNparSimultaneousConfLevel
,
plotPredIntNparSimultaneousDesign
,
predIntNpar
, tolIntNpar
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87  # Example 195 of USEPA (2009, p. 1933) shows how to compute nonparametric upper
# simultaneous prediction limits for various rules based on trace mercury data (ppb)
# collected in the past year from a site with four background wells and 10 compliance
# wells (data for two of the compliance wells are shown in the guidance document).
# The facility must monitor the 10 compliance wells for five constituents
# (including mercury) annually.
# We will pool data from 4 background wells that were sampled on
# a number of different occasions, giving us a sample size of
# n = 20 to use to construct the prediction limit.
# There are 10 compliance wells and we will monitor 5 different
# constituents at each well annually. For this example, USEPA (2009)
# recommends setting r to the product of the number of compliance wells and
# the number of evaluations per year (i.e., r = 10 * 1 = 10).
# Here we will reproduce Figure 192 on page 1935. This figure plots the
# power of the nonparametric simultaneous prediction interval for 6 different
# plans:
# Rule Median.n k m Order.Statistic Achieved.alpha BG.Limit
#1) k.of.m 1 1 3 Max 0.0055 0.28
#2) k.of.m 1 1 4 Max 0.0009 0.28
#3) Modified.CA 1 1 4 Max 0.0140 0.28
#4) k.of.m 3 1 2 Max 0.0060 0.28
#5) k.of.m 1 1 4 2nd 0.0046 0.25
#6) k.of.m 1 1 4 3rd 0.0135 0.24
# Here is the power curve for the 1of4 sampling strategy.
dev.new()
plotPredIntNparSimultaneousTestPowerCurve(n = 20, k = 1, m = 4, r = 10,
rule = "k.of.m", n.plus.one.minus.upl.rank = 3, pi.type = "upper",
r.shifted = 1, method = "approx", range.delta.over.sigma = c(0, 5), main = "")
title(main = paste(
"Power Curve for Nonparametric 1of4 Sampling Strategy Based on",
"25 Background Samples, SWFPR=10%, and 2 Future Sampling Periods",
sep = "\n"), cex.main = 1.1)
#
# Here are the power curves for all 6 sampling strategies.
# Because these take several seconds to create, here we have commented out
# the R commands. To run this example, just remove the pound signs (#) from
# in front of the R commands.
#dev.new()
#plotPredIntNparSimultaneousTestPowerCurve(n = 20, k = 1, m = 4, r = 10,
# rule = "k.of.m", n.plus.one.minus.upl.rank = 3, pi.type = "upper",
# r.shifted = 1, method = "approx", range.delta.over.sigma = c(0, 5), main = "")
#plotPredIntNparSimultaneousTestPowerCurve(n = 20, n.median = 3, k = 1, m = 2,
# r = 10, rule = "k.of.m", n.plus.one.minus.upl.rank = 1, pi.type = "upper",
# r.shifted = 1, method = "approx", range.delta.over.sigma = c(0, 5),
# add = TRUE, plot.col = 2, plot.lty = 2)
#plotPredIntNparSimultaneousTestPowerCurve(n = 20, r = 10, rule = "Modified.CA",
# n.plus.one.minus.upl.rank = 1, pi.type = "upper", r.shifted = 1,
# method = "approx", range.delta.over.sigma = c(0, 5), add = TRUE,
# plot.col = 3, plot.lty = 3)
#plotPredIntNparSimultaneousTestPowerCurve(n = 20, k = 1, m = 4, r = 10,
# rule = "k.of.m", n.plus.one.minus.upl.rank = 2, pi.type = "upper",
# r.shifted = 1, method = "approx", range.delta.over.sigma = c(0, 5),
# add = TRUE, plot.col = 4, plot.lty = 4)
#plotPredIntNparSimultaneousTestPowerCurve(n = 20, k = 1, m = 3, r = 10,
# rule = "k.of.m", n.plus.one.minus.upl.rank = 1, pi.type = "upper",
# r.shifted = 1, method = "approx", range.delta.over.sigma = c(0, 5),
# add = TRUE, plot.col = 5, plot.lty = 5)
#plotPredIntNparSimultaneousTestPowerCurve(n = 20, k = 1, m = 4, r = 10,
# rule = "k.of.m", n.plus.one.minus.upl.rank = 1, pi.type = "upper",
# r.shifted = 1, method = "approx", range.delta.over.sigma = c(0, 5),
# add = TRUE, plot.col = 6, plot.lty = 6)
#legend("topleft", legend = c("1of4, 3rd", "1of2, Max, Median", "Mod CA",
# "1of4, 2nd", "1of3, Max", "1of4, Max"), lwd = 3 * par("cex"),
# col = 1:6, lty = 1:6, bty = "n")
#title(main = "Figure 192. Comparison of Full Power Curves")
#==========
# Clean up
#
graphics.off()

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.