plotTolIntNparDesign {EnvStats}  R Documentation 
Create plots involving sample size (n
), coverage (\beta
), and confidence level
(1\alpha)
for a nonparametric tolerance interval.
plotTolIntNparDesign(x.var = "n", y.var = "conf.level", range.x.var = NULL, n = 25,
coverage = 0.95, conf.level = 0.95, ti.type = "two.sided", cov.type = "content",
ltl.rank = ifelse(ti.type == "upper", 0, 1),
n.plus.one.minus.utl.rank = ifelse(ti.type == "lower", 0, 1), plot.it = TRUE,
add = FALSE, n.points = 100, 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")
x.var 
character string indicating what variable to use for the xaxis. Possible values are

y.var 
character string indicating what variable to use for the yaxis. Possible values are

range.x.var 
numeric vector of length 2 indicating the range of the xvariable to use for the plot. The
default value depends on the value of 
n 
numeric scalar indicating the sample size. The default value is 
coverage 
numeric scalar between 0 and 1 specifying the coverage of the tolerance interval. The default
value is 
conf.level 
a scalar between 0 and 1 indicating the confidence level associated with the tolerance interval.
The default value is 
ti.type 
character string indicating what kind of tolerance interval to compute.
The possible values are 
cov.type 
character string specifying the coverage type for the tolerance interval.
The possible values are 
ltl.rank 
vector of positive integers indicating the rank of the order statistic to use for the lower bound
of the tolerance interval. If 
n.plus.one.minus.utl.rank 
vector of positive integers related to the rank of the order statistic to use for
the upper bound of the tolerance interval. A value of

plot.it 
a logical scalar indicating whether to create a plot or add to the
existing plot (see 
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 tolIntNpar
, tolIntNparConfLevel
,
tolIntNparCoverage
, and tolIntNparN
for information on how
to compute a nonparametric tolerance interval, how the confidence level
is computed when other quantities are fixed, how the coverage is computed when other
quantites are fixed, and and how the sample size is computed when other quantities are fixed.
plotTolIntNparDesign
invisibly returns a list with components
x.var
and y.var
, giving coordinates of the points that
have been or would have been plotted.
See the help file for tolIntNpar
.
In the course of designing a sampling program, an environmental scientist may wish to determine
the relationship between sample size, coverage, and confidence level if one of the objectives of
the sampling program is to produce tolerance intervals. The functions
tolIntNparN
, tolIntNparCoverage
, tolIntNparConfLevel
, and
plotTolIntNparDesign
can be used to investigate these relationships for
constructing nonparametric tolerance intervals.
Steven P. Millard (EnvStats@ProbStatInfo.com)
See the help file for tolIntNpar
.
tolIntNpar
, tolIntNparConfLevel
, tolIntNparCoverage
,
tolIntNparN
.
# Look at the relationship between confidence level and sample size for a twosided
# nonparametric tolerance interval.
dev.new()
plotTolIntNparDesign()
#==========
# Plot confidence level vs. sample size for various values of coverage:
dev.new()
plotTolIntNparDesign(coverage = 0.7, ylim = c(0,1), main = "")
plotTolIntNparDesign(coverage = 0.8, add = TRUE, plot.col = "red")
plotTolIntNparDesign(coverage = 0.9, add = TRUE, plot.col = "blue")
legend("bottomright", c("coverage = 70%", "coverage = 80%", "coverage = 90%"), lty=1,
lwd = 3 * par("cex"), col = c("black", "red", "blue"), bty = "n")
title(main = paste("Confidence Level vs. Sample Size for Nonparametric TI",
"with Various Levels of Coverage", sep = "\n"))
#==========
# Example 174 on page 1721 of USEPA (2009) uses copper concentrations (ppb) from 3
# background wells to set an upper limit for 2 compliance wells. There are 6 observations
# per well, and the maximum value from the 3 wells is set to the 95% confidence upper
# tolerance limit, and we need to determine the coverage of this tolerance interval.
tolIntNparCoverage(n = 24, conf.level = 0.95, ti.type = "upper")
#[1] 0.8826538
# Here we will modify the example and look at confidence level versus coverage for
# a set sample size of n = 24.
dev.new()
plotTolIntNparDesign(x.var = "coverage", y.var = "conf.level", n = 24, ti.type = "upper")
#==========
# Clean up
#
graphics.off()