joutlier: Recursive outlier detector/remover

Description Usage Arguments Value Examples

View source: R/joutlier.R

Description

Locate and remove outliers using an arima model to whiten time series, Hampel's MAD criterion to identify outliers, and kalman smoothing. Algorithm is recursive and continues until no further outliers are found.

Usage

1
joutlier(s, order = c(2, 0, 0), k = 10, tol = 3)

Arguments

s

timeseries

order

order specification of arima model; defaults to AR(2)

k

hampel's half-window size. Defines window for MAD computation

tol

MAD outlier threshold; defaults to 3 (Pearson's rule)

Value

cleaned timeseries.

Examples

1
2
3
4
5
6
7
y <- arimaSim( 200, ar = c( 0.5, -0.1 ) )
# Add a few outliers
o <- floor( runif( 5, min = 5, max = 195 ) )
y[o] <- runif( 5, min = 4, max = 8 )
yc <- joutlier( y )
plot( y )
lines( yc, col = "red" )

jrevenaugh/TSAUMN documentation built on Nov. 8, 2019, 2:20 p.m.