TSclust (version 1.2.4)

diss.SPEC.LLR: General Spectral Dissimilarity Measure Using Local-Linear Estimation of the Log-Spectra

Description

Computes a general dissimilarity measure based on the ratio of local linear spectral estimators.

Usage

diss.SPEC.LLR(x, y, alpha=0.5, method="DLS", plot=FALSE, n=length(x))

Arguments

x

Numeric vector containing the first of the two time series.

y

Numeric vector containing the second of the two time series.

alpha

Power for the ratio of densities in the Chernoff information measure. Between 0 and 1.

method

"DLS" for least squares estimation of the spectral density and "LK" for maximum likelihood estimation.

plot

if TRUE, plot the smoothed spectral densities of the two series.

n

The number of points to use for the linear interpolation. A value of n=0 uses numerical integration instead of linear interpolation. See details.

Value

The computed distance.

Details

$$ d_W = \int_{-\pi}^{\pi} W^{\prime}\Bigg( \frac{f_x(\lambda) } { f_y(\lambda) } \Bigg) d\lambda $$ where:

  • \(f_x\) and \(f_y\) are nonparametric approximations of spectral densities of x and y respectively.

  • \(W^{\prime}(x) = W(x) + W(1/x)\) with \(W(x) = \log( \alpha x + (1- \alpha) x) - \alpha \log(x)\), so that \(W(.)\) is a divergence function depending on \(\alpha\).

This dissimilarity measure corresponds to the limiting spectral approximation of the Chernoff information measure in the time domain (see Kakizawa et al., 1998). The spectral densities are approximated by using local linear fitting by generalized least squared if method=<U+201D>DLS<U+201D> or by maximum likelihood if method=<U+201D>LK<U+201D> (in this case, higher computational cost is required).

By default, for performance reasons, the spectral densities are estimated using linear interpolation using n points. If n is 0, no linear interpolation is performed, and integrate is used to calculate the integral, using as many points as integrate sees fit. If the dissimilarity will be calculated for more than two series, calling SPEC.LLR from the diss wrapper function is preferred, since it saves some computations.

References

Vilar, J.A. and P<U+00E9>rtega, S. (2004) Discriminant and cluster analysis for gaussian stationary processes: local linear fitting approach. J. Nonparametr. Stat., 16(3-4) 443--462.

Kakizawa, Y., Shumway, R. H. and Taniguchi M. (1998) Discrimination and clustering for multivariate time series. J. Amer. Statist. Assoc., 93(441), 328-- 340.

Montero, P and Vilar, J.A. (2014) TSclust: An R Package for Time Series Clustering. Journal of Statistical Software, 62(1), 1-43. http://www.jstatsoft.org/v62/i01/.

See Also

diss.SPEC.GLK, diss.SPEC.ISD, integrate

Examples

Run this code
# NOT RUN {
## Create three sample time series
x <- cumsum(rnorm(50))
y <- cumsum(rnorm(50))
z <- sin(seq(0, pi, length.out=50))
## Compute the distance and check for coherent results
diss.SPEC.LLR(x, y, plot=TRUE)
diss.SPEC.LLR(x, z, n=0) #try integrate instead of interpolation
diss.SPEC.LLR(y, z, method="LK", n=0) #maximum likelihood with integration
#create a dist object for its use with clustering functions like pam or hclust
diss(rbind(x,y,z), METHOD="SPEC.LLR", method="DLS", alpha=0.5, n=50)

# }

Run the code above in your browser using DataLab