# Kfactorsim: Estimating K-factors for Simultaneous Tolerance Intervals... In tolerance: Statistical Tolerance Intervals and Regions

## Description

Estimates k-factors for simultaneous tolerance intervals based on normality.

## Usage

 ```1 2``` ```K.factor.sim(n, l = NULL, alpha = 0.05, P = 0.99, side = 1, method = c("EXACT", "BONF"), m = 50) ```

## Arguments

 `n` If `method = "EXACT"`, this is the sample size of each of the `l` groups. If `method = "BONF"`, then `n` can be a vector of different sample sizes for the `l` groups. `l` The number of normal populations for which the k-factors will be constructed simultaneously. If `NULL`, then it is taken to be the length of `n`. `alpha` The level chosen such that `1-alpha` is the confidence level. `P` The proportion of the population to be covered by the tolerance interval. `side` Whether a k-factor for a 1-sided or 2-sided tolerance interval is required (determined by `side = 1` or `side = 2`, respectively). `method` The method for calculating the k-factors. `"EXACT"` is an exact method that can be used when all `l` groups have the same sample size. `"BONF"` is an approximate method using the Bonferroni inequality, which can be used when the `l` groups have different sample sizes. `m` The maximum number of subintervals to be used in the `integrate` function. This is necessary only for `method = "EXACT"`. 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"`.

## Value

`K.factor` returns the k-factor for simultaneous tolerance intervals based on normality with the arguments specified above.

## Note

For larger combinations of `n` and `l` when `side = 2` and `method = "EXACT"`, the calculation can be slow. For larger sample sizes when `side = "BONF"`, there may be some accuracy issues with the 1-sided calculation since it depends on the noncentral t-distribution. The code is primarily intended to be used for moderate values of the noncentrality parameter. It will not be highly accurate, especially in the tails, for large values. See `TDist` for further details.

Thanks to Andrew Landgraf for providing the basic code for the `method = "EXACT"` procedure.

## References

Krishnamoorthy, K. and Mathew, T. (2009), Statistical Tolerance Regions: Theory, Applications, and Computation, Wiley.

Mee, R. W. (1990), Simultaneous Tolerance Intervals for Normal Populations with Common Variance, Technometrics, 32, 83-92.

## See Also

`integrate`, `K.factor`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ``` ## Reproducing part of Table B5 from Krishnamoorthy and ## Mathew (2009). n_sizes <- c(2:20, seq(30, 100, 10)) l_sizes <- 2:10 KM_table <- sapply(1:length(l_sizes), function(i) sapply(1:length(n_sizes), function(j) round(K.factor.sim(n = n_sizes[j], l = l_sizes[i], side=1, alpha = 0.1, P = 0.9),3))) dimnames(KM_table) <- list(n = n_sizes, l = l_sizes) KM_table ```

tolerance documentation built on Feb. 6, 2020, 5:08 p.m.