###################################################################### ################# PERFORMANCE TEST METHODS ###################### ###################################################################### # This script can be used to evaluate the performance of methods # with selected (optimised) parameters (defined in each method section). #### define working environment #### #setwd("D:/ETC-ACM/Tasks/1022_3/R/finalisedScripts") # load methods #load("methods.RData") # load Airbase data #load("airbase.RData") #### data sets #### # un-comment the data set you would like to test # monthly x = I.eval x_out = I_out #x = II.eval #x_out = II_out #x = III.eval #x_out = III_out # hourly #x = I.r.eval #x_out = I.r_out #x = II.r.eval #x_out = II.r_out #x = III.r.eval #x_out = III_out ###################################################################### ################# AUTOREGRESSIVE MODEL ###################### ###################################################################### #### Parameters #### ar_lag = 2 ar_sd.factor = 15.5 #### Methods #### # get outliers system.time(ar.outliers(x, ar_lag, ar_sd.factor)) ar_out = ar.outliers(x, ar_lag, ar_sd.factor) #### Validation #### jaccard(x, ar_out, x_out, tolerance=5, plot=T) ###################################################################### ################# MOVING WINDOW - WHOLE WINDOW ###################### ###################################################################### #### Parameters #### # window size q = 14 # outlier thresholds factor.sd.glob = 3 #### Methods #### system.time(mw.outliers.sd(x, q, mean, factor.sd.glob, diffs=NULL)) mw_out = mw.outliers.sd(x, q, mean, factor.sd.glob, diffs=NULL) #### Validation #### jaccard(x, mw_out, x_out, tolerance=5, plot=T) ########################################################################## ################# MOVING WINDOW - TWO-SIDED WINDOW ###################### ########################################################################## #### Parameters #### # window size q = 28 # outlier thresholds factor.sd.glob = 0.8 #### Methods #### system.time(mw2.outliers.sd(x, q, min, factor.sd.glob, mw=NULL)) mw2_out = mw2.outliers.sd(x, q, min, factor.sd.glob, mw=NULL) #### Validation #### jaccard(x, mw2_out, x_out, tolerance=5, plot=T) ###################################################################### ################# MOVING WINDOW - LAG 1 DIFFS ###################### ###################################################################### #### Parameters #### # window size q = 25 # parameters for thresholds alpha = 0.0001 beta = 0.0005 gamma = 0.0025 p = c(alpha, beta, gamma) #### Methods #### library(VGAM) system.time(lag1.outliers.all(x, q, qlaplace, p, mw.lag1=NULL)) lag1_out = lag1.outliers.all(x, q, qlaplace, p, mw.lag1=NULL) #### Validation #### jaccard(x, lag1_out[[1]], x_out, tolerance=5, plot=T) #################################################### ################# KZA FILTER ###################### #################################################### #### Parameters #### # window size q=15 # number of filter iterations k=1 # parameters for outlier detection quantil=0.005 #### Methods #### #### non-adaptive KZ filter #### system.time(kz.outliers(x, q, k, FALSE, quantil, F)) kz_out = kz.outliers(x, q, k, FALSE, quantil, T) #### Validation #### jaccard(x, kz_out, x_out, tolerance=10, plot=T)