Chauvenet: Chauvenets function to remove outliers

Description Usage Arguments Details Value References Examples

View source: R/Chauvenet.R

Description

Remove outliers from a vector based on Chauvenets criterion.

Usage

1
Chauvenet(v, loop = FALSE)

Arguments

v

v vector of numeric values

loop

loop logical value; if TRUE, process will be repeated until no more values can be removed

Details

Calculates z value for each value in the vector (from mean and standard deviation). Then removes elements where the erfc of the z value is >0.5. (erfc = complementary error function). If loop = TRUE, this process will be repeated until no more values can be removed.

Value

A numeric vector, with outliers removed; preserves order of original vector. The vector will contain at least two values.

References

William Chauvenet, A Manual of Spherical and Practical Astronomy V.II , Lippincott, Philadelphia, 1st Ed (1863); Reprint of 1891 5th Ed: Dover, NY (1960).

Examples

1
2
3
v1 <- c( 101.2, 90.0, 99.0, 102.0, 103.0, 100.2, 89.0, 98.1, 101.5, 102.0)
Chauvenet(v1) # 2 outliers removed
Chauvenet(v1, loop=TRUE) # 8 outliers removed (the maximum)

Peirce documentation built on May 2, 2019, 5 p.m.