trimmed_mean: Trimmed Mean

Description Usage Arguments

Description

The sample median is an example of what is called atrimmed mean; it trims all but one or two values. The sample mean represents the other extreme: zero trimming.

No specific amount of trimming is always best, but for various reasons, 20% trimming is often a good choice. This means that the smallest 20% and the largest 20% are trimmed and the average of the remaining data is computed.

In symbols, first compute 0.2n, round down to the nearest integer, call this result g, in which case the 20% trimmed mean is given by

\overline{X} = \frac{1}{n - 2g} (X_{(g+1)} + \cdots + X_{(n-g)})

Usage

1
trimmed_mean(x, trim = 0.2, na.rm = FALSE)

Arguments

x

An R object. Currently there are methods for numeric/logical vectors and date, date-time and time interval objects. Complex vectors are allowed for trim = 0, only.

trim

the fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed. Values of trim outside that range are taken as the nearest endpoint.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.


shizidushu/fsrs documentation built on May 26, 2019, 4:32 a.m.