Computes prediction intervals for censored data assuming lognormal, gamma and normal distributions.

cenPredInt(
  x.var,
  cens.var,
  pi.type = "two-sided",
  conf = 0.95,
  newobs = 1,
  method = "mle",
  printstat = TRUE
)

Arguments

x.var

The column of x (response variable) detected values plus detection limits

cens.var

The column of indicators, where 1 (or TRUE) indicates a detection limit in the y.var column, and 0 (or FALSE) indicates a detected value in y.var.

pi.type

Designation of either a “two-sided” interval (default) or a 1-sided “upper” or 1-sided “lower” interval.

conf

Confidence coefficient of the interval, 0.95 (default).

newobs

The number of new observations to be contained in the interval.

method

Character string specifying the method of estimation. Default is mle (maximum likelihood). See details.

printstat

Logical TRUE/FALSE option of whether to print the resulting statistics in the console window, or not. Default is TRUE.

Value

A table of prediction limits based on user provided confidence coefficient (conf) and prediction invterval type (pi.type)

Details

Computes prediction intervals for three distributions. This is a front-end to the individual functions from the EnvStats package. By default all three are computed using maximum likelihood estimation (mle). The gamma distribution for censored data uses the Wilson-Hilferty approximation (normal distribution on cube roots of data). Other methods are available in EnvStats, but few methods are available for all three distributions. For info on other methods, see help for elnormCensored and enormCensored commands in EnvStats.

References

Helsel, D.R., 2011. Statistics for censored environmental data using Minitab and R, 2nd ed. John Wiley & Sons, USA, N.J.

Millard, S.P., 2013. EnvStats: An R Package for Environmental Statistics. Springer-Verlag, New York.

Krishnamoorthy, K., Mathew, T., Mukherjee, S., 2008. Normal-Based Methods for a Gamma Distribution, Technometrics, 50, 69-78.

Examples

data(PbHeron)

# Default
cenPredInt(PbHeron$Liver,PbHeron$LiverCen)
#> 95% Prediction Limits
#>   Distribution       95% LPL  95% UPL
#> 1    Lognormal   0.001464239 28.13403
#> 2        Gamma   0.000000000 24.93266
#> 3       Normal -24.332274410 30.61011

# User defined confidence coefficient
cenPredInt(PbHeron$Liver,PbHeron$LiverCen, conf=0.5)
#> 50% Prediction Limits
#>   Distribution       50% LPL   50% UPL
#> 1    Lognormal  0.0393247897  1.047557
#> 2        Gamma  0.0001337408  3.271342
#> 3       Normal -6.0029976395 12.280833

# User defined confidence coefficient outside of acceptable range
# the procedure will stop and give an error.
# cenPredInt(PbHeron$Liver,PbHeron$LiverCen, conf=1.1)

# User defined prediction interval type
cenPredInt(PbHeron$Liver,PbHeron$LiverCen,pi.type="lower")
#> 95% Lower Prediction Limit
#>   Distribution       95% LPL 95% UPL
#> 1    Lognormal   0.003390088      NA
#> 2        Gamma   0.000000000      NA
#> 3       Normal -19.655870206      NA
cenPredInt(PbHeron$Liver,PbHeron$LiverCen,pi.type="upper")
#> 95% Upper Prediction Limit
#>   Distribution 95% LPL  95% UPL
#> 1    Lognormal      NA 12.15159
#> 2        Gamma      NA 16.67494
#> 3       Normal      NA 25.93371