censStats: Mean and Standard Deviation

View source: R/censStats.R

censStatsR Documentation

Mean and Standard Deviation

Description

Computes the mean and standard deviation of censored data.

Usage

censStats(x, method = "MLE", na.rm = FALSE, alpha = 0.4)

## Default S3 method:
censStats(x, method = "MLE", na.rm = FALSE, alpha = 0.4)

## S3 method for class 'lcens'
censStats(x, method = "MLE", na.rm = FALSE, alpha = 0.4)

## S3 method for class 'mcens'
censStats(x, method = "MLE", na.rm = FALSE, alpha = 0.4)

## S3 method for class 'qw'
censStats(x, method = "log MLE", na.rm = FALSE, alpha = 0.4)

Arguments

x

an object of a censored-data class whose sample mean and standard deviation are needed.

method

the method to use for computing the statistics. See Details.

na.rm

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

alpha

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

Details

The methods available in the current version are "log MLE," "MLE," "log ROS," "ROS," "log AMLE," "AMLE," and "flipped K-M." The method "flipped K-M" produces statistics using the Kaplan-Meier method on flipped data described by Helsel (2012). The methods "log ROS," "log MLE," and "log AMLE" are described by Helsel (2012) and Helsel and Cohn (1988). The methods "ROS," "MLE," and "AMLE" are similar to the previous except that no log- and back-transforms are made on the data. For "log" methods, if any value in x is negative, then a warning is generated and the returned list contains missing values.

Value

A list with one component for mean and sd. If "log" methods are specified, then the meanlog amd meansd components are also included. The values returned for method="flipped K-M" can be of class "mcens."

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

mdlAMLE, mdlKM, mdlKMstats, mdlMLE, mdlROS

Examples


set.seed(936)
Y <- rlnorm(32)
# Uncensored statistics
censStats(Y, method="log MLE")
# Censored statistics, at 1 (37.5 percent)
censStats(as.lcens(Y, 1), method="log MLE")


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