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

1 | ```
diss.SPEC.ISD(x, y, plot=FALSE, n=length(x))
``` |

`x` |
Numeric vector containing the first of the two time series. |

`y` |
Numeric vector containing the second of the two time series. |

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

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

The computed distance.

Pablo Montero Manso, José Antonio Vilar.

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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.