censQtiles.CI: Quantiles with Confidence Limits

View source: R/censQtiles.CI.R

censQtiles.CIR Documentation

Quantiles with Confidence Limits

Description

Computes sample quantiles and confidence limits of left-censored data for specified probabilities.

Usage

censQtiles.CI(x, probs = 0.5, CI = 0.9, bound = c("two.sided", "upper",
  "lower"))

Arguments

x

any R object than can be converted to class "lcens" to compute the sample quantiles. Missung values are permitted and are removed before computing the quantiles.

probs

numeric vector of desired probabilities with values between 0 and 1.

CI

the minimum desired confidence interval for each level specifed in probs.

bound

a character string indicating the desired bounds, "two.sided" means the two-sided interval, "upper" means the upper bound of the interval, and "lower" means the lower bound of the interval. Only a single character is needed. The lower confidence limit is -Inf when bound is "upper" and the upper confidence limit is Inf when bound is "lower."

Details

The survfit function in the survival package is used to compute the flipped Kaplan-Meier statistics. The type of confidence interval is "plain," which produces symmetric confidence intervals that maintain consistency when back flipping the estimates and is consisten with the B-C method described by Helsel (2012).

Value

A matrix of sample quantiles, the lower confidence limit, the upper confidence limit, and the probability represented by the confidence interval corresponding to the probs levels in the sorted x data. Missing values denote values less than the minimum (either censored or uncensored) value. The minimum value is included as the "minimum" attribute of the matrix. The maximum value is included as the "maximum" attribute of the matrix.

References

Helsel, D.R. 2012, Statistics for censored environmental data using Minitab and R: New York, Wiley, 324 p.

See Also

censQuantile

Examples


## Generate a random sample
set.seed(222)
XX.rn <- rexp(32)
# Compare uncensored to the binomial method
censQtiles.CI(XX.rn, probs=c(.25, .5, .75))
qtiles.CI(XX.rn, probs=c(.25, .5, .75))


USGS-R/smwrQW documentation built on Oct. 11, 2022, 6:13 a.m.