Free and open-source implementation in R of Outskewer, a method to detect outliers in data sets of numbers and in time series. It is distributed under the MIT License.
###Usage ####Load functions
setwd('path/to/outskewer') # to edit
source("outskewer.r")
source("utils.r")
####Execute on a vector of numbers
tmp <- DetectOutliers(x)
results.df <- SetFinalOutlierStatus(tmp$df)
####Execute on a time series
# Load data, give proper names to the data frame columns.
# File structure: timestamp, value
# 1 10807
# 2 10873
# 3 10902
data.df <- read.table('ts.dat')
colnames(data.df) <- c("t","x")
# Run outskewer with a time window with size of w values.
results.df <- DetectOutliersDynamically(data.df, w=100)
results.df <- SetFinalOutlierStatus(results.df)
###Display results ####Number of outliers detected
summary(factor(results.df$status))
####Cumulative frequency with points colored by outlier status
g <- PlotCumulative(results.df)
g <- DecoratePlot(g) # optional
g
####Skewness signature of a distribution of values
PlotSignature(x)
####Time series with points colored by outlier status
g <- PlotTimeSeries(results.df)
g <- DecoratePlot(g) # optional
g
###Save in file ####Results
# Save in a tabular format
ExportData(data=results.df, filename='my_results')
####Plot
# Save in PDF, EPS and PNG
ExportPlot(gplot=g, filename='my_results', width=10, height=5)