Provides 1-sided or 2-sided Bayesian tolerance intervals under the conjugate prior for data distributed according to a normal distribution.
bayesnormtol.int(x = NULL, norm.stats = list(x.bar = NA,
s = NA, n = NA), alpha = 0.05, P = 0.99,
side = 1, method = c("HE", "HE2", "WBE",
"ELL", "KM", "EXACT", "OCT"), m = 50,
hyper.par = list(mu.0 = NULL,
sig2.0 = NULL, m.0 = NULL, n.0 = NULL))
bayesnormtol.int
returns a data frame with items:
The specified significance level.
The proportion of the population covered by this tolerance interval.
The sample mean.
The 1-sided lower Bayesian tolerance bound. This is given only if side = 1
.
The 1-sided upper Bayesian tolerance bound. This is given only if side = 1
.
The 2-sided lower Bayesian tolerance bound. This is given only if side = 2
.
The 2-sided upper Bayesian tolerance bound. This is given only if side = 2
.
A vector of data which is distributed according to a normal distribution.
An optional list of statistics that can be provided in-lieu of the full dataset. If provided, the user must specify all three components: the sample mean (x.bar
), the sample standard deviation (s
), and the sample size (n
).
The level chosen such that 1-alpha
is the confidence level.
The proportion of the population to be covered by this tolerance interval.
Whether a 1-sided or 2-sided tolerance interval is required (determined by side = 1
or side = 2
,
respectively).
The method for calculating the k-factors. The k-factor for the 1-sided tolerance intervals
is performed exactly and thus is the same for the chosen method. "HE"
is the
Howe method and is often viewed as being extremely accurate, even for small sample sizes. "HE2"
is a second method due to Howe, which performs similarly to the Weissberg-Beatty method, but is computationally simpler. "WBE"
is the
Weissberg-Beatty method (also called the Wald-Wolfowitz method), which performs similarly to the first Howe method for larger sample sizes. "ELL"
is
the Ellison correction to the Weissberg-Beatty method when f
is appreciably larger than n^2
. A warning
message is displayed if f
is not larger than n^2
. "KM"
is the Krishnamoorthy-Mathew approximation to the exact solution, which works well for larger sample sizes. "EXACT"
computes the
k-factor exactly by finding the integral solution to the problem via the integrate
function. Note the computation time of this method is largely determined by m
. "OCT"
is the Owen approach
to compute the k-factor when controlling the tails so that there is not more than (1-P)/2 of the data in each tail of the distribution.
The maximum number of subintervals to be used in the integrate
function. This is necessary only for method = "EXACT"
and method = "OCT"
. The larger
the number, the more accurate the solution. Too low of a value can result in an error. A large value can also cause the function to be slow for method = "EXACT"
.
A list consisting of the hyperparameters for the conjugate prior: the hyperparameters for the mean (mu.0
and n.0
) and the hyperparameters for the variance (sig2.0
and m.0
).
Note that if one considers the non-informative prior distribution, then the Bayesian tolerance intervals are the same as the classical solution, which can be obtained by using normtol.int
.
Aitchison, J. (1964), Bayesian Tolerance Regions, Journal of the Royal Statistical Society, Series B, 26, 161--175.
Guttman, I. (1970), Statistical Tolerance Regions: Classical and Bayesian, Charles Griffin and Company.
Young, D. S., Gordon, C. M., Zhu, S., and Olin, B. D. (2016), Sample Size Determination Strategies for Normal Tolerance Intervals Using Historical Data, Quality Engineering, 28, 337--351.
Normal
, normtol.int
, K.factor
## 95%/85% 2-sided Bayesian normal tolerance limits for
## a sample of size 100.
set.seed(100)
x <- rnorm(100)
out <- bayesnormtol.int(x = x, alpha = 0.05, P = 0.85,
side = 2, method = "EXACT",
hyper.par = list(mu.0 = 0,
sig2.0 = 1, n.0 = 10, m.0 = 10))
out
plottol(out, x, plot.type = "both", side = "upper",
x.lab = "Normal Data")
Run the code above in your browser using DataLab