# fidnegbintolint: Fiducial-Based Tolerance Intervals for the Function of Two... In tolerance: Statistical Tolerance Intervals and Regions

## Description

Provides 1-sided or 2-sided tolerance intervals for the function of two negative binomial proportions using fiducial quantities.

## Usage

 ```1 2 3``` ```fidnegbintol.int(x1, x2, n1, n2, m1 = NULL, m2 = NULL, FUN, alpha = 0.05, P = 0.99, side = 1, K = 1000, B = 1000) ```

## Arguments

 `x1` A value of observed "failures" from group 1. `x2` A value of observed "failures" from group 2. `n1` The target number of successes for group 1. `n2` The target number of successes for group 2. `m1` The total number of future trials for group 1. If `NULL`, then it is set to `n1`. `m2` The total number of future trials for group 2. If `NULL`, then it is set to `n2`. `FUN` Any reasonable (and meaningful) function taking exactly two arguments that we are interested in constructing a tolerance interval on. `alpha` The level chosen such that 1-alpha is the confidence level. `P` The proportion of the population to be covered by this tolerance interval. `side` Whether a 1-sided or 2-sided tolerance interval is required (determined by `side = 1` or `side = 2`, respectively). `K` The number of fiducial quantities to be generated. The number of iterations should be at least as large as the default value of 1000. See `Details` for the definition of the fiducial quantity for a negative binomial proportion. `B` The number of iterations used for the Monte Carlo algorithm which determines the tolerance limits. The number of iterations should be at least as large as the default value of 1000.

## Details

If X is observed from a NegBin(n,p) distribution, then the fiducial quantity for p is Beta(n,X+0.5).

## Value

`fidnegbintol.int` returns a list with two items. The first item (`tol.limits`) is a data frame with the following items:

 `alpha` The specified significance level. `P` The proportion of the population covered by this tolerance interval. `fn.est` A point estimate of the functional form of interest using the maximum likelihood estimates calculated with the inputted values of `x1`, `x2`, `n1`, and `n2`. `1-sided.lower` The 1-sided lower tolerance bound. This is given only if `side = 1.` `1-sided.upper` The 1-sided upper tolerance bound. This is given only if `side = 1.` `2-sided.lower` The 2-sided lower tolerance bound. This is given only if `side = 2.` `2-sided.upper` The 2-sided upper tolerance bound. This is given only if `side = 2.`

The second item (`fn`) simply returns the functional form specified by `FUN`.

## References

Cai, Y. and Krishnamoorthy, K. (2005), A Simple Improved Inferential Method for Some Discrete Distributions, Computational Statistics and Data Analysis, 48, 605–621.

Clopper, C. J. and Pearson, E. S. (1934), The Use of Confidence or Fiducial Limits Illustrated in the Case of the Binomial, Biometrika, 26, 404–413.

Krishnamoorthy, K. and Lee, M. (2010), Inference for Functions of Parameters in Discrete Distributions Based on Fiducial Approach: Binomial and Poisson Cases, Journal of Statistical Planning and Inference, 140, 1182–1192.

Mathew, T. and Young, D. S. (2013), Fiducial-Based Tolerance Intervals for Some Discrete Distributions, Computational Statistics and Data Analysis, 61, 38–49.

`fidbintol.int`, `fidpoistol.int`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```## 95%/99% 1-sided and 2-sided tolerance intervals for ## the ratio of odds ratios for negative binomial proportions. set.seed(100) p1 <- 0.6 p2 <- 0.2 n1 <- n2 <- 50 x1 <- rnbinom(1, n1, p1) x2 <- rnbinom(1, n2, p2) fun.ti <- function(x, y) x * (1 - y) / (y * (1 - x)) fidnegbintol.int(x1, x2, n1, n2, m1 = 50, m2 = 50, FUN = fun.ti, alpha = 0.05, P = 0.99, side = 1) fidnegbintol.int(x1, x2, n1, n2, m1 = 50, m2 = 50, FUN = fun.ti, alpha = 0.05, P = 0.99, side = 2) ```