# diss.SPEC.ISD: Dissimilarity Based on the Integrated Squared Difference... In TSclust: Time Series Clustering Utilities

## Description

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

## Usage

 `1` ```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.

## Details

d(x,y) = INT( (m_x(λ) - m_y(λ))^2 )dλ

where m_x(λ) and m_y(λ) 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.

## Value

The computed distance.

## Author(s)

Pablo Montero Manso, José Antonio Vilar.

## References

Pé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/.

`diss.SPEC.GLK`, `diss.SPEC.LLR`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```## 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" ) ## End(Not run) ```