Generalized Pivotal Quantity for Tolerance Interval for a Normal Distribution Based on Censored Data
Source:R/0package.R
gpqTolIntNormCensored.RdGenerate a generalized pivotal quantity (GPQ) for a tolerance interval for a Normal distribution based on singly or multiply censored data.
Usage
gpqTolIntNormSinglyCensored(n, n.cen, p, probs, nmc, method = "mle",
censoring.side = "left", seed = NULL, names = TRUE)
gpqTolIntNormMultiplyCensored(n, cen.index, p, probs, nmc, method = "mle",
censoring.side = "left", seed = NULL, names = TRUE)Arguments
- n
positive integer \(\ge 3\) indicating the sample size.
- n.cen
for the case of singly censored data, a positive integer indicating the number of censored observations. The value of
n.cenmust be between1andn-2, inclusive.- cen.index
for the case of multiply censored data, a sorted vector of unique integers indicating the indices of the censored observations when the observations are “ordered”. The length of
cen.indexmust be between1andn-2, inclusive, and the values ofcen.indexmust be between1andn.- p
numeric scalar strictly greater than 0 and strictly less than 1 indicating the quantile for which to generate the GPQ(s) (i.e., the coverage associated with a one-sided tolerance interval).
- probs
numeric vector of values between 0 and 1 indicating the confidence level(s) associated with the GPQ(s).
- nmc
positive integer \(\ge 10\) indicating the number of Monte Carlo trials to run in order to compute the GPQ(s).
- method
character string indicating the method to use for parameter estimation.
For singly censored data, possible values are"mle"(the default),"bcmle","qq.reg","qq.reg.w.cen.level","impute.w.qq.reg","impute.w.qq.reg.w.cen.level","impute.w.mle","iterative.impute.w.qq.reg","m.est", and"half.cen.level". See the help file forenormCensoredfor details.
For multiply censored data, possible values are"mle"(the default),"qq.reg","impute.w.qq.reg", and"half.cen.level". See the help file forenormCensoredfor details.- censoring.side
character string indicating on which side the censoring occurs. The possible values are
"left"(the default) and"right".- seed
positive integer to pass to the function
set.seed. This argument is ignored ifseed=NULL(the default). Using theseedargument lets you reproduce the exact same result if all other arguments stay the same.- names
a logical scalar passed to
quantileindicating whether to add a names attribute to the resulting GPQ(s). The default value isnames=TRUE.
Details
The function gpqTolIntNormSinglyCensored generates GPQs as described in Algorithm 12.1
of Krishnamoorthy and Mathew (2009, p. 329). The function
gpqTolIntNormMultiplyCensored is an extension of this idea to multiply censored data.
These functions are called by tolIntNormCensored when ti.method="gpq",
and also by eqnormCensored when ci=TRUE and ci.method="gpq". See
the help files for these functions for an explanation of GPQs.
Note that technically these are only GPQs if the data are Type II censored. However, Krishnamoorthy and Mathew (2009, p. 328) state that in the case of Type I censored data these quantities should approximate the true GPQs and the results appear to be satisfactory, even for small sample sizes.
The functions gpqTolIntNormSinglyCensored and gpqTolIntNormMultiplyCensored are
computationally intensive and provided to the user to allow you to create your own tables.
References
Krishnamoorthy K., and T. Mathew. (2009). Statistical Tolerance Regions: Theory, Applications, and Computation. John Wiley and Sons, Hoboken.
Author
Steven P. Millard (EnvStats@ProbStatInfo.com)
Note
Tolerance intervals have long been applied to quality control and life testing problems (Hahn, 1970b,c; Hahn and Meeker, 1991; Krishnamoorthy and Mathew, 2009). References that discuss tolerance intervals in the context of environmental monitoring include: Berthouex and Brown (2002, Chapter 21), Gibbons et al. (2009), Millard and Neerchal (2001, Chapter 6), Singh et al. (2010b), and USEPA (2009).
Examples
# Reproduce the entries for n=10 observations with n.cen=1 in Table 12.2
# of Krishnamoorthy and Mathew (2009, p.331).
#
# (Note: passing a value for the argument "seed" simply allows you to
# reproduce this example.)
#
# NOTE: Here to save computing time for the sake of example, we will specify
# just 100 Monte Carlos, whereas Krishnamoorthy and Mathew (2009)
# suggest *10,000* Monte Carlos.
gpqTolIntNormSinglyCensored(n = 10, n.cen = 1, p = 0.05, probs = 0.05,
nmc = 100, seed = 529)
#> 5%
#> -3.483403
# 5%
#-3.483403
gpqTolIntNormSinglyCensored(n = 10, n.cen = 1, p = 0.1, probs = 0.05,
nmc = 100, seed = 497)
#> 5%
#> -2.66705
# 5%
#-2.66705
gpqTolIntNormSinglyCensored(n = 10, n.cen = 1, p = 0.9, probs = 0.95,
nmc = 100, seed = 623)
#> 95%
#> 2.478654
# 95%
#2.478654
gpqTolIntNormSinglyCensored(n = 10, n.cen = 1, p = 0.95, probs = 0.95,
nmc = 100, seed = 623)
#> 95%
#> 3.108452
# 95%
#3.108452
#==========
# Example of using gpqTolIntNormMultiplyCensored
#-----------------------------------------------
# Consider the following set of multiply left-censored data:
dat <- 12:16
censored <- c(TRUE, FALSE, TRUE, FALSE, FALSE)
# Since the data are "ordered" we can identify the indices of the
# censored observations in the ordered data as follow:
cen.index <- (1:length(dat))[censored]
cen.index
#> [1] 1 3
#[1] 1 3
# Now we can generate a GPQ using gpqTolIntNormMultiplyCensored.
# Here we'll generate a GPQ corresponding to an upper tolerance
# interval with coverage 90% with 95% confidence for
# left-censored data.
# NOTE: Here to save computing time for the sake of example, we will specify
# just 100 Monte Carlos, whereas Krishnamoorthy and Mathew (2009)
# suggest *10,000* Monte Carlos.
gpqTolIntNormMultiplyCensored(n = 5, cen.index = cen.index, p = 0.9,
probs = 0.95, nmc = 100, seed = 237)
#> Warning: NA/NaN function evaluation
#> Warning: NA/NaN function evaluation
#> Warning: NA/NaN function evaluation
#> 95%
#> 3.952052
# 95%
#3.952052
#==========
# Clean up
#---------
rm(dat, censored, cen.index)