Calculate the residuals of a CSI process.

csi_resid(dX, drift, acf, Sigma)

Arguments

dX

Matrix of trajectory increments.

drift

Matrix of the same size as dX of increment drift in each coordinate per timepoint (see 'Details').

acf

Autocorrelation vector of length nrow(dX) (see 'Details').

Sigma

Covariance matrix of size ncol(dX) x ncol(dX).

Value

A residual matrix of the same size as dX.

Details

The residuals are calculated as

Z = toeplitz(acf)^{-1/2} %*% (dX - drift) %*% Sigma^{-1/2},

where the "square roots" correspond to the Cholesky decomposition for the row-dependence matrix toeplitz(acf), and the eigen decomposition for the column-dependence matrix Sigma.

Examples

# simulate data from the fbm model
alpha <- .8

dt <- 1/60
N <- 1800
ndim <- 2

Xt <- csi_sim(drift = matrix(0, N-1, ndim),
              acf = fbm_acf(alpha, dt, N-1),
              Sigma = diag(ndim),
              X0 = rep(0, ndim))


# compute the residuals
Z <- csi_resid(dX = apply(Xt, 2, diff),
               drift = matrix(0, N-1, ndim),
               acf = fbm_acf(alpha, dt, N-1),
               Sigma = diag(ndim))