ACF: Auto-Covariance and Correlation Functions

Description Usage Arguments Details Value Author(s) Examples

View source: R/ACF.R

Description

The ACF function computes the estimated autocovariance or autocorrelation for both univariate and multivariate cases.

Usage

1
ACF(x, lagmax = 0, cor = TRUE, demean = TRUE)

Arguments

x

A matrix with dimensions N x S or N observations and S processes

lagmax

A integer indicating the max lag.

cor

A bool indicating whether the correlation (TRUE) or covariance (FALSE) should be computed.

demean

A bool indicating whether the data should be detrended (TRUE) or not (FALSE)

Details

lagmax default is 10*log10(N/m) where N is the number of observations and m is the number of series being compared. If lagmax supplied is greater than the number of observations, then one less than the total will be taken.

Value

An array of dimensions N x S x S.

Author(s)

Yunxiang Zhang

Examples

1
2
3
4
5
# Get Autocorrelation
m = ACF(datasets::AirPassengers)

# Get Autocovariance and do not remove trend from signal
m = ACF(datasets::AirPassengers, cor = FALSE, demean = FALSE)

SMAC-Group/simts documentation built on Feb. 21, 2018, 3:34 p.m.