trim.mean: Trimmed mean

View source: R/trim.mean.R

Trimmed meanR Documentation

Trimmed mean

Description

Trimmed mean.

Usage

trim.mean(x, a = 0.05,parallel=FALSE)
colTrimMean(x, a = 0.05,parallel=FALSE,cores=0)
## S3 method for class 'matrix'
colTrimMean(x,a = 0.05,parallel=FALSE,cores=0)
## S3 method for class 'data.frame'
colTrimMean(x,a = 0.05,parallel=FALSE,cores=0)
rowTrimMean(x, a = 0.05,parallel=FALSE,cores=0)

Arguments

x

A numerical vector or a numerical matrix or data.frame.

a

A number in (0, 1), the proportion of data to trim.

parallel

Run the algorithm parallel in C++.

cores

Number of cores to use for parallelism. Valid only when argument parallel is set to TRUE. Default value is 0 and it means the maximum supported cores.

Details

The trimmed mean is computed. The lower and upper a% of the data are removed and the mean is calculated using the rest of the data.

Value

The trimmed mean.

Author(s)

Michail Tsagris and Manos Papadakis.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr and Manos Papadakis papadakm95@gmail.com.

References

Wilcox R.R. (2005). Introduction to robust estimation and hypothesis testing. Academic Press.

See Also

Quantile

Examples

x <- rnorm(100, 1, 1)
all.equal(trim.mean(x, 0.05),mean(x, 0.05))

x<-matrix(x,10,10)

colTrimMean(x,0.05)
rowTrimMean(x,0.05)

Rfast2 documentation built on Aug. 8, 2023, 1:11 a.m.