tsOutliers | R Documentation |
This function identifies statistical outliers in a ts
object based on
upper and lower quantile criteria. The function body is mainly taken from
stats.stackexchange.com.
tsOutliers(
x,
lower_quantile = 0.2,
upper_quantile = 0.8,
plot = FALSE,
index = FALSE,
...
)
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 |
A numeric vector of scores or, if index = TRUE
, a vector holding the
indices of identified outliers.
Florian Detsch
ts
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.