TSclust (version 1.2.4)

diss.SPEC.GLK: Dissimilarity based on the Generalized Likelihood Ratio Test

Description

The dissimilarity between two time series is computed by using an adaptation of the generalized likelihood ratio test to check the equality of two log-spectra.

Usage

diss.SPEC.GLK(x, y, plot=FALSE)

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, the smoothed spectral densities of the two series are plotted.

Value

The computed distance.

Details

The dissimilarity between two series x and y is measured in terms of the vaue of a test statistic to check the equality of their log-spectra, \(m_X(\lambda)\) and \(m_Y(\lambda)\) respectivelty. The test statistic is constructed by using the generalized likelihood ratio test criterion (Fan and Zhang, 2004). Specifically, the test statistic takes the form: $$ d(x,y) = \sum_{k=1}^T [ Z_k - \hat{\mu}( \lambda_k) - 2 \log( 1 + e^{ \{ Z_k - \hat{\mu}(\lambda_k)\}})] - \sum_{k=1}^T[Z_k - 2 \log(1 + e^{Z_k})],$$

where \(I_x(\lambda_k)\) and \(I_y(\lambda_k)\) are the periodograms of x and y, \( Z_k = \log(I_x(\lambda_k)) - \log( I_y(\lambda_k))\), and \(\hat{\mu}(\lambda_k)\) is the local maximum log-likelihood estimator of \(\mu(\lambda_k)= m_x(\lambda_k) - m_y(\lambda_k)\) computed by local linear fitting.

References

Fan, J. and Zhang, W. (2004) Generalised likelihood ratio tests for spectral density. Biometrika, 195--209.

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.ISD, 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.GLK(x, y, plot=TRUE)
#create a dist object for its use with clustering functions like pam or hclust
# }
# NOT RUN {
diss( rbind(x,y,z), "SPEC.GLK" )
# }

Run the code above in your browser using DataCamp Workspace