# NOT RUN {
library(anomaly)
# Simulated data example
# Generate data typically following a normal distribution with mean 0 and variance 1.
# Then introduce 3 anomaly windows and 4 point outliers.
set.seed(2018)
x = rnorm(5000)
x[1601:1700] = rnorm(100,0,0.01)
x[3201:3300] = rnorm(100,0,10)
x[4501:4550] = rnorm(50,10,1)
x[c(1000,2000,3000,4000)] = rnorm(4,0,100)
# use magrittr to pipe the data to the transform
library(magrittr)
trans<-.%>%tierney(1000)
res<-scapa.uv(x,transform=trans)
# Plot results at two different times and note that anomalies are re-evaluated:
plot(res,epoch=3201)
plot(res,epoch=3205)
# }
Run the code above in your browser using DataLab