diss.SPEC.GLK {TSclust} | R Documentation |
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 |
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.
Value
The computed distance.
Author(s)
Pablo Montero Manso, José Antonio Vilar.
References
Fan, J. and Zhang, W. (2004) Generalised likelihood ratio tests for spectral density. Biometrika, 195–209.
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/.
See Also
Examples
## 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
diss( rbind(x,y,z), "SPEC.GLK" )