Learn R Programming

mlmts (version 1.1.2)

dis_var_1: Constructs a pairwise distance matrix based on the estimated VAR coefficients of the series

Description

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

Usage

dis_var_1(X, max_p = 1, criterion = "AIC", 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_{VAR}\).

Arguments

X

A list of MTS (numerical matrices).

max_p

The maximum order considered with respect to the fitting of VAR models.

criterion

The criterion used to determine the VAR order.

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_{VAR}(\boldsymbol X_T, \boldsymbol Y_T)=||\widehat{\boldsymbol \theta}^{\boldsymbol X_T}_{VAR}- \widehat{\boldsymbol \theta}^{\boldsymbol Y_T}_{VAR}||,$$ where \(\widehat{\boldsymbol \theta}^{\boldsymbol X_T}_{VAR}\) and \(\widehat{\boldsymbol \theta}^{\boldsymbol Y_T}_{VAR}\) are vectors containing the estimated VAR parameters for \(\boldsymbol X_T\) and \(\boldsymbol Y_T\), respectively. If VAR models of different orders are fitted to \(\boldsymbol X_T\) and \(\boldsymbol Y_T\), then the shortest vector is padded with zeros until it reaches the length of the longest vector.

References

piccolo1990distancemlmts

See Also

dis_var_2, diss.AR.PIC

Examples

Run this code
toy_dataset <- Libras$data[1 : 2] # Selecting the first 2 MTS from the
# dataset Libras
distance_matrix <- dis_var_1(toy_dataset) # Computing the pairwise
# distance matrix based on the distance dis_var_1
feature_dataset <- dis_var_1(toy_dataset, features = TRUE) # Computing
# the corresponding dataset of features

Run the code above in your browser using DataLab