diss.SPEC.LLR {TSclust} | R Documentation |
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 |
|
plot |
if |
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. |
Details
d_W = \int_{-\pi}^{\pi} W^{\prime}\Bigg( \frac{f_x(\lambda) } { f_y(\lambda) } \Bigg) d\lambda
where:
-
f_x
andf_y
are nonparametric approximations of spectral densities ofx
andy
respectively. -
W^{\prime}(x) = W(x) + W(1/x)
withW(x) = \log( \alpha x + (1- \alpha) x) - \alpha \log(x)
, so thatW(.)
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=”DLS”
or by maximum likelihood if method=”LK”
(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.
Value
The computed distance.
Author(s)
Pablo Montero Manso, José Antonio Vilar.
References
Vilar, J.A. and Pé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
## 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)