Learn R Programming

mlmts (version 1.1.2)

dis_cor: Constructs a pairwise distance matrix based on auto and cross-correlations

Description

dis_cor returns a pairwise distance matrix based on a generalization of the dissimilarity introduced by d2009autocorrelation;textualmlmts.

Usage

dis_cor(X, lag_max = 1, features = FALSE)

Value

If features = FALSE (default), returns a distance matrix based on the distance \(d_{COR}\). Otherwise, the function returns a dataset of feature vectors, i.e., each row in the dataset contains the features employed to compute the distance \(d_{COR}\).

Arguments

X

A list of MTS (numerical matrices).

lag_max

The maximum lag considered to compute the auto and cross-correlations.

features

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

Author

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

Details

Given a collection of MTS, the function returns the pairwise distance matrix, where the distance between two MTS \(\boldsymbol X_T\) and \(\boldsymbol Y_T\) is defined as $$d_{COR}(\boldsymbol X_T, \boldsymbol Y_T)=\Big|||\widehat{\boldsymbol \theta}^{\boldsymbol X_T}_{AC}- \widehat{\boldsymbol \theta}^{\boldsymbol Y_T}_{AC}||^2+||\widehat{\boldsymbol \theta}^{\boldsymbol X_T}_{CC}- \widehat{\boldsymbol \theta}^{\boldsymbol Y_T}_{CC}||^2\Big|^{1/2},$$ where \(\widehat{\boldsymbol \theta}^{\boldsymbol X_T}_{AC}\) and \(\widehat{\boldsymbol \theta}^{\boldsymbol Y_T}_{AC}\) are vectors containing the estimated autocorrelations within \(\boldsymbol X_T\) and \(\boldsymbol Y_T\), respectively, and \(\widehat{\boldsymbol \theta}^{\boldsymbol X_T}_{CC}\) and \(\widehat{\boldsymbol \theta}^{\boldsymbol Y_T}_{CC}\) are vectors containing the estimated cross-correlations within \(\boldsymbol X_T\) and \(\boldsymbol Y_T\), respectively.

References

d2009autocorrelationmlmts

Examples

Run this code
toy_dataset <- AtrialFibrillation$data[1 : 10] # Selecting the first 10 MTS from the
# dataset AtrialFibrillation
distance_matrix <- dis_cor(toy_dataset) # Computing the pairwise
# distance matrix based on the distance dis_cor
distance_matrix <- dis_cor(toy_dataset, lag_max = 5) # Considering
# auto and cross-correlations up to lag 5 in the computation of the distance
feature_dataset <- dis_cor(toy_dataset, features = TRUE) # Computing
# the corresponding dataset of features

Run the code above in your browser using DataLab