cenPredInt: Prediction interval for censored data

View source: R/cenPredInt.R

cenPredIntR Documentation

Prediction interval for censored data

Description

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

Usage

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.

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.

Value

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

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.

See Also

EnvStats::enormCensored

Examples

data(PbHeron)

# Default
cenPredInt(PbHeron$Liver,PbHeron$LiverCen)

# User defined confidence coefficient
cenPredInt(PbHeron$Liver,PbHeron$LiverCen, conf=0.5)

# 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")
cenPredInt(PbHeron$Liver,PbHeron$LiverCen,pi.type="upper")


NADA2 documentation built on Oct. 20, 2023, 5:07 p.m.