censQuantile: Sample Quantiles

View source: R/censQuantile.R

censQuantileR Documentation

Sample Quantiles

Description

Computes sample or estimated quantiles corresponding to the given probabilities. The smallest observation (censored or uncensored) corresponds to a probability of 0 and the largest to a probability of 1.

Usage

censQuantile(x, probs = seq(0, 1, 0.25), na.rm = FALSE, method = "ROS",
  type = 2, alpha = 0.4)

## Default S3 method:
censQuantile(x, probs = seq(0, 1, 0.25), na.rm = FALSE,
  method = "", type = 2, alpha = 0.4)

## S3 method for class 'lcens'
censQuantile(x, probs = seq(0, 1, 0.25), na.rm = FALSE,
  method = "ROS", type = 2, alpha = 0.4)

## S3 method for class 'mcens'
censQuantile(x, probs = seq(0, 1, 0.25), na.rm = FALSE,
  method = "flipped K-M", type = 2, alpha = 0.4)

## S3 method for class 'qw'
censQuantile(x, probs = seq(0, 1, 0.25), na.rm = FALSE,
  method = "log MLE", type = 2, alpha = 0.4)

Arguments

x

an object of a censored-data class whose sample quantiles are wanted.

probs

numeric vector of probabilities with values in [0,1].

na.rm

logical; if TRUE, any NA and NaNs are removed from x before the quantiles are computed.

method

the method to use for computing quantiles. See Details.

type

an integer between 1 and 9 selecting one of the nine quantile algorithms detailed below to be used. See quantile for a description of the types.

alpha

the offset fraction to be used, depending on method; typically in [0,1].

Details

The methods available in the current version are "flipped K-M," "log ROS," "ROS," "log MLE," and "MLE." The method "flipped K-M" produces quantiles using the Kaplan-Meier method on fliiped data described by Helsel (2012). The methods "log ROS" and "log MLE" are described by Helsel, 2012 and Helsel and Cohn (1988). The methods "ROS" and "MLE" are similar to "log ROS" and "log MLE" except that no log- and back-transforms are made on the data.

Value

An object of class "censQuantile" with one named component for each level requested in probs. The values returned for method="flipped K-M" can be of class "lcens."

References

Helsel, D.R. 2012, Statistics for censored environmental data using Minitab and R: New York, Wiley, 324 p.
Helsel, D.R. and Cohn, T.A., 1988, Estimation of descriptive statistics for multiply censored water quality data: Water Resources Research v. 24, n. 12, pp. 1997-2004

See Also

quantile, quantile.lcens

Examples


set.seed(28)
Xu <- rnorm(23)
censQuantile(Xu) # Uncensored (true) quartiles
censQuantile(as.lcens(Xu, 0)) # How'd ROS do?
censQuantile(as.lcens(Xu, 0), method="MLE") # How'd ROS do?


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