arbitragelab.copula_approach.vine_copula_partner_selection
Module for implementing partner selection approaches for vine copulas.
Module Contents
Classes
Implementation of the Partner Selection procedures proposed in Section 3.1.1 in the following paper. |
- class PartnerSelection(prices: pandas.DataFrame, n: int = 50)
Implementation of the Partner Selection procedures proposed in Section 3.1.1 in the following paper.
3 partner stocks are selected for a target stock based on four different approaches namely, Traditional approach, Extended approach, Geometric approach and Extremal approach.
In this module, target stock implies the ticker for which a unique combination of stocks is returned. The stocks present in this unique combination are called partner stocks.
- traditional(n_targets: int = 5) list
This method implements the first procedure described in Section 3.1.1.
For all possible quadruples of a given stock, we calculate the sum of all pairwise correlations. For every target stock the quadruple with the highest sum is returned.
- Parameters:
n_targets – (int) Number of target stocks to select.
- Returns:
(list) List of all selected quadruples.
- extended(n_targets: int = 5) list
This method implements the second procedure described in Section 3.1.1.
It involves calculating the multivariate version of Spearman’s correlation for all possible quadruples of a given stock. The final measure taken into consideration is the mean of the three versions of Spearman’s rho given in Schmid and Schmidt (2007). For every target stock the quadruple with the highest calculated measure is returned.
- Parameters:
n_targets – (int) Number of target stocks to select.
- Returns:
(list) List of all selected quadruples.
- geometric(n_targets: int = 5) list
This method implements the third procedure described in Section 3.1.1.
It involves calculating the four dimensional diagonal measure for all possible quadruples of a given stock. For example, visually, say we are in 2D, we have a Quantile-Quantile plot for the data, and this measure is just the sum of Euclidean distance for all data points to the y=x line (diagonal). For every target stock the quadruple with the lowest diagonal measure is returned.
- Parameters:
n_targets – (int) Number of target stocks to select.
- Returns:
(list) List of all selected quadruples.
- extremal(n_targets: int = 5, d: int = 4) list
This method implements the fourth procedure described in Section 3.1.1.
It involves calculating a non-parametric test statistic based on Mangold (2015) to measure the degree of deviation from independence. Main focus of this measure is the occurrence of joint extreme events.
- Parameters:
n_targets – (int) Number of target stocks to select.
d – (int) Number of partner stocks(including target stock).
- Return output_matrix:
(list) List of all selected combinations.
- plot_selected_pairs(quadruples: list) list
For the list of quadruples, this method plots the line plots of the cumulative returns of all stocks in quadruple.
- Parameters:
quadruples – (list) List of quadruples.
- Returns:
(list) List of Axes objects.