plotCiNparDesign {EnvStats}  R Documentation 
Create plots involving sample size, quantile, and confidence level for a nonparametric confidence interval for a quantile.
plotCiNparDesign(x.var = "n", y.var = "conf.level", range.x.var = NULL,
n = 25, p = 0.5, conf.level = 0.95, ci.type = "two.sided",
lcl.rank = ifelse(ci.type == "upper", 0, 1),
n.plus.one.minus.ucl.rank = ifelse(ci.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

p 
numeric scalar specifying the quantile. The value of this argument must be
between 0 and 1. The default value is 
conf.level 
a scalar between 0 and 1 indicating the confidence level associated with the confidence interval.
The default value is 
ci.type 
character string indicating what kind of confidence interval to compute. The
possible values are 
lcl.rank , n.plus.one.minus.ucl.rank 
numeric vectors of nonnegative integers indicating the ranks of the
order statistics that are used for the lower and upper bounds of the
confidence interval for the specified quantile(s). When 
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 files for eqnpar
, ciNparConfLevel
,
and ciNparN
for information on how to compute a
nonparametric confidence interval for a quantile, how the confidence level
is computed when other quantities are fixed, and how the sample size is
computed when other quantities are fixed.
plotCiNparDesign
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 eqnpar
.
Steven P. Millard (EnvStats@ProbStatInfo.com)
See the help file for eqnpar
.
eqnpar
, ciNparConfLevel
,
ciNparN
.
# Look at the relationship between confidence level and sample size for
# a twosided nonparametric confidence interval for the 90'th percentile.
dev.new()
plotCiNparDesign(p = 0.9)
#
# Plot sample size vs. quantile for various levels of confidence:
dev.new()
plotCiNparDesign(x.var = "p", y.var = "n", range.x.var = c(0.8, 0.95),
ylim = c(0, 60), main = "")
plotCiNparDesign(x.var = "p", y.var = "n", conf.level = 0.9, add = TRUE,
plot.col = 2, plot.lty = 2)
plotCiNparDesign(x.var = "p", y.var = "n", conf.level = 0.8, add = TRUE,
plot.col = 3, plot.lty = 3)
legend("topleft", c("95%", "90%", "80%"), lty = 1:3, col = 1:3,
lwd = 3 * par('cex'), bty = 'n')
title(main = paste("Sample Size vs. Quantile for ",
"Nonparametric CI for \nQuantile, with ",
"Various Confidence Levels", sep=""))
#==========
# Clean up
#
graphics.off()