TSclust (version 1.2.4)

diss.SPEC.ISD: Dissimilarity Based on the Integrated Squared Difference between the Log-Spectra

Description

Computes the dissimilarity between two time series in terms of the integrated squared difference between non-parametric estimators of their log-spectra.

Usage

diss.SPEC.ISD(x, y, 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.

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(x,y) = \int ( \hat{m}_x(\lambda) - \hat{m}_y(\lambda))^2 \, d\lambda, $$ where \( \hat{m}_x(\lambda) \) and \( \hat{m}_y(\lambda) \) are local linear smoothers of the log-periodograms, obtained using the maximum local likelihood criterion.

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.

References

P<U+00E9>rtega, S. and Vilar, J.A. (2010) Comparing several parametric and nonparametric approaches to time series clustering: A simulation study. J. Classification, 27(3), 333--362.

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.LLR

Examples

Run this code
# NOT RUN {
## Create two 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.ISD(x, y, plot=TRUE) 
#create a dist object for its use with clustering functions like pam or hclust
# }
# NOT RUN {
diss.SPEC.ISD(x, y, plot=TRUE, n=0)#try integrate instead of interpolation
diss( rbind(x,y,z), "SPEC.ISD" )
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab