# tsOutliers: Identification of statistical outliers in time series In environmentalinformatics-marburg/eimarGsodTools: Functions to download and process GSOD data

## Description

This function identifies statistical outliers in a `ts` object based on upper and lower quantile criteria. The function body is mainly taken from http://stats.stackexchange.com/questions/1142/simple-algorithm-for-online-outlier-detection-of-a-generic-time-series.

## Usage

 ```1 2``` ```tsOutliers(x, lower_quantile = 0.2, upper_quantile = 0.8, plot = FALSE, index = FALSE, ...) ```

## Arguments

 `x` Numeric. A vector of observed time-series values. `lower_quantile` Numeric, default is 0.2. The lower quantile limit. `upper_quantile` Numeric, default is 0.8. The upper quantile limit. `plot` Logical, default is FALSE. If TRUE, a time-series plot including identified outliers is generated. `index` Logical, default is FALSE. If TRUE, a vector holding the indices of identified outliers is returned rather than the statistically obtained scores for each measured value. `...` Additional arguments passed to `ts`.

## Value

A numeric vector of scores or, if `index = TRUE`, a vector holding the indices of identified outliers.

## Author(s)

Florian Detsch

`ts`
 ```1 2 3 4 5 6 7``` ```# Random time-series values set.seed(10) x <- rnorm(100, 0, 2) # Return indices of outliers incl. visualization tsOutliers(x, lower_quantile = .35, upper_quantile = .7, plot = TRUE, index = TRUE) ```