Learn R Programming

anomaly (version 4.0.2)

moving_ac_corrected: Transforms the data X to account for autocorrelation using a moving window and a burn-in.

Description

Transforms the data X by centring and scaling using \(X_{ij}^{'} = \frac{X_{ij}-\mu_{ij}}{k_{i} \sigma_{ij}}\) where \(\mu_{ij}\) and \(\sigma_{ij}\) are robust estimates for location and scale based on the median and the median absolute deviation of each variate (column) \(X_{i}\) of X calculated on a moving window centred at j. The scaling \(k_{i} = \surd{\left( \frac{1+\phi_{i}}{1-\phi_{i}} \right)}\) is a robust estimate for the autocorrelation at lag 1 calculated on an initial (burn-in) segment of the data where \(\phi_{i}\) is calculated using a robust estimate for the autocorrelation of the burn-in segment.

Usage

moving_ac_corrected(X, burnin, window_size)

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. The time series data classes ts, xts, and zoo are also supported.

burnin

A positive integer indicating the initial length of the data used to determine the value of \(\phi_{i}\).

window_size

A positive integer indication the length of the moving window.

Value

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