winvar: Winsorized variance

Description Usage Arguments Details Examples

Description

Winsorized variance

Usage

1
winvar(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.

Details

When using a trimmed mean, certain types of analyses, require a Winsorized variance.

The process of Winsorizing data by 20% is related to 20% trimming. Recall that when computing a 20% trimmed mean, the g smallest and the g largest observations are removed, where g = 0.2n rounded down to the nearest integer, in which case the 20% trimmed mean is the average of the remaining values.

Winsorizing the data by 20% means that the g smallest values are not trimmed, but rather, they are set equal to the smallest value not trimmed. Similarly, the g largest values are set equal to the largest value not trimmed.

Examples

1
2
x <- c(1, 2, 8, 9, 10, 16, 18, 22, 27, 29, 35, 42)
winvar(x)

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