ciNparN {EnvStats}  R Documentation 
Sample Size for Nonparametric Confidence Interval for a Quantile
Description
Compute the sample size necessary to achieve a specified confidence level for a nonparametric confidence interval for a quantile.
Usage
ciNparN(p = 0.5, lcl.rank = ifelse(ci.type == "upper", 0, 1),
n.plus.one.minus.ucl.rank = ifelse(ci.type == "lower", 0, 1),
ci.type = "two.sided", conf.level = 0.95)
Arguments
p 
numeric vector of probabilities specifying the quantiles.
All values of 
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 
ci.type 
character string indicating what kind of confidence interval to compute. The
possible values are 
conf.level 
numeric vector of numbers between 0 and 1 indicating the confidence level
associated with the confidence interval(s). The default value is

Details
If the arguments p
, lcl.rank
,
n.plus.one.minus.ucl.rank
and conf.level
are not all the
same length, they are replicated to be the
same length as the length of the longest argument.
The help file for eqnpar
explains how nonparametric confidence
intervals for quantiles are constructed and how the confidence level
associated with the confidence interval is computed based on specified values
for the sample size and the ranks of the order statistics used for
the bounds of the confidence interval.
The function ciNparN
determines the required the sample size via
a nonlinear optimization.
Value
numeric vector of sample sizes.
Note
See the help file for eqnpar
.
Author(s)
Steven P. Millard (EnvStats@ProbStatInfo.com)
References
See the help file for eqnpar
.
See Also
eqnpar
, ciNparConfLevel
,
plotCiNparDesign
.
Examples
# Look at how the required sample size for a confidence interval
# increases with increasing confidence level for a fixed quantile:
seq(0.5, 0.9, by = 0.1)
#[1] 0.5 0.6 0.7 0.8 0.9
ciNparN(p = 0.9, conf.level=seq(0.5, 0.9, by = 0.1))
#[1] 7 9 12 16 22
#
# Look at how the required sample size for a confidence interval increases
# as the quantile moves away from 0.5:
ciNparN(p = seq(0.5, 0.9, by = 0.1))
#[1] 6 7 9 14 29