tolIntNparN | R Documentation |
Compute the sample size necessary for a nonparametric tolerance interval (for a continuous
distribution) with a specified coverage and, in the case of a \beta
-content tolerance
interval, a specified confidence level, given the ranks of the order statistics used for the
interval.
tolIntNparN(coverage = 0.95, conf.level = 0.95, cov.type = "content",
ltl.rank = ifelse(ti.type == "upper", 0, 1),
n.plus.one.minus.utl.rank = ifelse(ti.type == "lower", 0, 1),
ti.type = "two.sided")
coverage |
numeric vector of values between 0 and 1 indicating the desired coverage of the tolerance interval. |
conf.level |
numeric vector of values between 0 and 1 indicating the confidence level of the tolerance interval. |
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
|
ti.type |
character string indicating what kind of tolerance interval to compute.
The possible values are |
If the arguments coverage
, conf.level
, ltl.rank
, and
n.plus.one.minus.utl.rank
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 tolIntNpar
explains how nonparametric tolerance intervals
are constructed.
Computing Required Sample Size for a \beta
-Content Tolerance Interval (cov.type="content"
)
For a \beta
-content tolerance interval, if the coverage C=\beta
is specified, then the
associated confidence level (1-\alpha)100\%
is computed as:
1 - \alpha = 1 - F(\beta, v-u, w+u) \;\;\;\;\;\; (1)
where F(y, \delta, \gamma)
denotes the cumulative distribution function of a
beta random variable with parameters shape1=
\delta
and
shape2=
\gamma
evaluated at y
. The value of 1-\alpha
is determined by
the argument conf.level
. The value of \beta
is determined by the argument
coverage
. The value of u
is determined by the argument ltl.rank
. The value
of w
is determined by the argument
n.plus.one.minus.utl.rank
. Once these values
have been determined, the above equation can be solved implicitly for n
, since
v = n + 1 - w \;\;\;\;\;\; (2)
Computing Required Sample Size for a \beta
-Expectation Tolerance Interval (cov.type="expectation"
)
For a \beta
-expectation tolerance interval, the expected coverage is simply the mean of a
beta random variable with parameters shape1=
v-u
and
shape2=
w+u
, which is given by:
E(C) = \frac{v-u}{n+1} \;\;\;\;\;\; (3)
or, using Equation (2) above, we can re-write the formula for the expected coverage as:
E(C) = \frac{n+1-w-u}{n+1} = 1 - \frac{u+w}{n+1} \;\;\;\;\;\; (4)
Thus, for user-specified values of u
(ltl.rank
),
w
(n.plus.one.minus.utl.rank
), and expected coverage, the required sample
size is computed as:
n = Ceiling\{ [ \frac{u+w}{1-E(C)} ] - 1 \} \;\;\;\;\;\; (5)
where Ceiling(x)
denotes the smallest integer greater than or equal to x
.
(See the R help file for ceiling
).
A vector of positive integers indicating the required sample size(s) for the specified nonparametric tolerance interval(s).
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
,
plotTolIntNparDesign
.
# Look at how the required sample size for a nonparametric tolerance interval increases
# with increasing confidence level:
seq(0.5, 0.9, by = 0.1)
#[1] 0.5 0.6 0.7 0.8 0.9
tolIntNparN(conf.level = seq(0.5, 0.9, by = 0.1))
#[1] 34 40 49 59 77
#----------
# Look at how the required sample size for a nonparametric tolerance interval increases
# with increasing coverage:
tolIntNparN(coverage = seq(0.5, 0.9, by = 0.1))
#[1] 8 10 14 22 46
#----------
# Look at how the required sample size for a nonparametric tolerance interval increases
# with the rank of the lower tolerance limit:
tolIntNparN(ltl.rank = 1:5)
#[1] 93 124 153 181 208
#==========
# Example 17-4 on page 17-21 of USEPA (2009) uses copper concentrations (ppb) from 3
# background wells to set an upper limit for 2 compliance wells. 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 determine the sample size required to produce
# a tolerance interval with 95% confidence level AND 95% coverage.
tolIntNparN(coverage = 0.95, conf.level = 0.95, ti.type = "upper")
#[1] 59
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.