ac_corrected: Transforms the data X to account for autocorrelation.

Description Usage Arguments Value Examples

View source: R/ac_corrected.R

Description

Transforms the data X to account for autocorrelation by centring and scaling. It uses the transformation X_{i}^{'} = \frac{X_{i}-μ_{i}}{k_{i}σ_{i}}, were μ_{i} and σ_{i} are robust estimates for the mean and standard deviation of each variate (column), X_{i}, of X. The estimates are calculated using the median and median absolute deviation. The scaling k_{i} = \surd{≤ft( \frac{1+φ_{i}}{1-φ_{i}} \right)}, with φ_{i} a robust estimate for the autocorrelation at lag 1, is used to account for AR(1) structure in the noise.

Usage

1

Arguments

X

A numeric matrix containing the potentially multivariate data to be transformed. Each column corresponds to a component and each row to an observation.

Value

A numeric matrix of the same dimension as X containing the transformed data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(anomaly)
data(acgh)
# use the first three individuals
X<-acgh[,1:3]
# compare the medians of each variate and transformed variate
head(apply(X,2,median))
head(apply(ac_corrected(X),2,median))
# compare the variances of each variate and transformed variate
head(apply(X,2,var))
head(apply(ac_corrected(X),2,var))

Fisch-Alex/anomaly documentation built on Sept. 4, 2019, 10:12 p.m.