Learn R Programming

TSclust (version 1.1)

diss.ACF: Autocorrelation-based Dissimilarity

Description

Computes the dissimilarity between two time series as the distance between their estimated simple (ACF) or partial (PACF) autocorrelation coefficients.

Usage

diss.ACF(x, y, p = NULL, omega=NULL, lag.max=50)
diss.PACF(x, y, p = NULL, omega=NULL, lag.max=50)

Arguments

x
Numeric vector containing the first of the two time series.
y
Numeric vector containing the second of the two time series.
p
If not NULL, sets the weight for the geometric decaying of the autocorrelation coefficients. Ranging from 0 to 1.
lag.max
Maximum number of simple or partial autocorrelation coefficients to be considered.
omega
If not NULL, completely specifies the weighting matrix for the autocorrelation coefficients. p is ignored if omega is used.

Value

  • The computed distance.

Details

Performs the weighted Euclidean distance between the simple autocorrelation ( dist.ACF) or partial autocorrelation ( dist.PACF ) coefficients. If neither p nor omega are specified, uniform weighting is used. If p is specified, geometric wights decaying with the lag in the form $p(1-p)^i$ are applied. If omega ($\Omega$) is specified, $$d(x,y) = {{ ( \hat{\rho}_{x} - \hat{\rho}_{y} )^t \bm{\Omega} (\hat{\rho}_{x} - \hat{\rho}_{y} ) }}^\frac{1}{2}$$ with $\hat{\rho}_{x}$ and $\hat{\rho}_{y}$ the respective (partial) autocorrelation coefficient vectors.

References

Galeano, P. and Peña, D. (2000). Multivariate analysis in vector time series. Resenhas, 4 (4), 383--403.

See Also

diss.COR

Examples

Run this code
## Create three sample time series
x <- cumsum(rnorm(100))
y <- cumsum(rnorm(100))
z <- sin(seq(0, pi, length.out=100))
## Compute the distance and check for coherent results
diss.PACF(x, y)
diss.ACF(x, z)
diss.PACF(y, z)
#create a dist object for its use with clustering functions like pam or hclust
if (require(proxy)) {
  proxy::dist( rbind(x,y,z), diss.ACF, p=0.05)
}

Run the code above in your browser using DataLab