Learn R Programming

robnptests (version 1.1.0)

win_mean: Winsorized mean

Description

win_mean calculates the winsorized mean of a sample.

Usage

win_mean(x, gamma = 0.2, na.rm = FALSE)

Value

The winsorized mean.

Arguments

x

a (non-empty) numeric vector of data values.

gamma

a numeric value in [0, 0.5] specifying the fraction of observations to be replaced at each end of the sample before calculating the mean. The default value is 0.2.

na.rm

a logical value indicating whether NA values in x and y should be stripped before the computation proceeds. The default is na.rm = FALSE.

Examples

Run this code
# Generate random samples
set.seed(108)
x <- rnorm(10)

# Compute 20% winsorized mean
win_mean(x, gamma = 0.2)

Run the code above in your browser using DataLab