dis_spectral: Constructs a pairwise distance matrix based on estimated...

View source: R/dis_spectral.R

dis_spectralR Documentation

Constructs a pairwise distance matrix based on estimated spectral matrices

Description

dis_spectral returns a pairwise distance matrix based on the dissimilarities introduced by \insertCitekakizawa1998discrimination;textualmlmts.

Usage

dis_spectral(X, method = "j_divergence", alpha = 0.5, features = FALSE)

Arguments

X

A list of MTS (numerical matrices).

method

Parameter indicating the method to be used for the computation of the distance. If method="j_divergence" (default), the J divergence is considered. If method="chernoff_divergence", the Chernoff information divergence is considered

alpha

If method="chernoff_divergence", parameter alpha in (0,1) used for the computation of the Chernoff divergence (default is 0.5).

features

Logical. If features = FALSE (default), a distance matrix is returned. Otherwise, the function returns a dataset of feature vectors.

Details

Given a collection of MTS, the function returns a pairwise distance matrix. If method="j_divergence" then the distance between two MTS \boldsymbol X_T and \boldsymbol Y_T is defined as

d_{JSPEC}(\boldsymbol X_T, \boldsymbol Y_T)=\frac{1}{2T} \sum_{k=1}^{K}\bigg(tr\Big(\widehat{\boldsymbol f}_{\boldsymbol X_T}(\omega_k) \widehat{\boldsymbol f}_{\boldsymbol Y_T}^{-1}(\omega_k)\Big) +tr\Big(\widehat{\boldsymbol f}_{\boldsymbol Y_T}(\omega_k) \widehat{\boldsymbol f}_{\boldsymbol X_T}^{-1}(\omega_k)\Big)-2d\bigg),

where \widehat{\boldsymbol f}_{\boldsymbol X_T}(\omega_k) and \widehat{\boldsymbol f}_{\boldsymbol Y_T}(\omega_k) are the estimated spectral density matrices from the series \boldsymbol X_T and \boldsymbol Y_T, respectively, evaluated at frequency \omega_k, and tr(\cdot) denotes the trace of a square matrix. If method="chernoff_divergence", then the distance between two MTS \boldsymbol X_T and \boldsymbol Y_T is defined as

d_{CSPEC}(\boldsymbol X_T, \boldsymbol Y_T)=

\frac{1}{2T} \sum_{k=1}^{K}\bigg(\log{\frac{\Big|\alpha\widehat{\boldsymbol f}^{\boldsymbol X_T}(\omega_k) +(1-\alpha)\widehat{\boldsymbol f}^{\boldsymbol Y_T}(\omega_k)\Big |} {\Big|\widehat{\boldsymbol f}^{\boldsymbol Y_T}(\omega_k)\Big|}}+ \log{\frac{\Big|\alpha\widehat{\boldsymbol f}^{\boldsymbol Y_T}(\omega_k) + (1-\alpha)\widehat{\boldsymbol f}^{\boldsymbol X_T}(\omega_k)\Big |} {\Big|\widehat{\boldsymbol f}^{\boldsymbol X_T}(\omega_k)\Big|}}\bigg),

where \alpha \in (0,1).

Value

If features = FALSE (default), returns a distance matrix based on the distance d_{JSPEC} as long as we set method="j_divergence", and based on the alternative distance d_{CSPEC} as long as we set method= "chernoff_divergence". Otherwise, if features = TRUE, the function returns a dataset of feature vectors, i.e., each row in the dataset contains the features employed to compute either d_{JSPEC} or d_{CSPEC}. These vectors are vectorized versions of the estimated spectral matrices.

Author(s)

Ángel López-Oriona, José A. Vilar

References

\insertRef

kakizawa1998discriminationmlmts

Examples

toy_dataset <- Libras$data[1 : 10] # Selecting the first 10 MTS from the
# dataset Libras
distance_matrix_j <- dis_spectral(toy_dataset) # Computing the pairwise
# distance matrix based on the distance dis_jspec
distance_matrix_c <- dis_spectral(toy_dataset,
method = 'chernoff_divergence') # Computing the pairwise
# distance matrix based on the distance dis_cspec
feature_dataset <- dis_qcd(toy_dataset, features = TRUE) # Computing
# the corresponding dataset of features for d_cpec

mlmts documentation built on Sept. 11, 2024, 6:41 p.m.

Related to dis_spectral in mlmts...