CrossRiskClassCorrelation21.java

  1. package org.drip.simm.common;

  2. /*
  3.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  4.  */

  5. /*!
  6.  * Copyright (C) 2020 Lakshmi Krishnamurthy
  7.  * Copyright (C) 2019 Lakshmi Krishnamurthy
  8.  * Copyright (C) 2018 Lakshmi Krishnamurthy
  9.  *
  10.  *  This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics,
  11.  *      asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment
  12.  *      analytics, and portfolio construction analytics within and across fixed income, credit, commodity,
  13.  *      equity, FX, and structured products. It also includes auxiliary libraries for algorithm support,
  14.  *      numerical analysis, numerical optimization, spline builder, model validation, statistical learning,
  15.  *      and computational support.
  16.  *  
  17.  *      https://lakshmidrip.github.io/DROP/
  18.  *  
  19.  *  DROP is composed of three modules:
  20.  *  
  21.  *  - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/
  22.  *  - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
  23.  *  - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/
  24.  *
  25.  *  DROP Product Core implements libraries for the following:
  26.  *  - Fixed Income Analytics
  27.  *  - Loan Analytics
  28.  *  - Transaction Cost Analytics
  29.  *
  30.  *  DROP Portfolio Core implements libraries for the following:
  31.  *  - Asset Allocation Analytics
  32.  *  - Asset Liability Management Analytics
  33.  *  - Capital Estimation Analytics
  34.  *  - Exposure Analytics
  35.  *  - Margin Analytics
  36.  *  - XVA Analytics
  37.  *
  38.  *  DROP Computational Core implements libraries for the following:
  39.  *  - Algorithm Support
  40.  *  - Computation Support
  41.  *  - Function Analysis
  42.  *  - Model Validation
  43.  *  - Numerical Analysis
  44.  *  - Numerical Optimizer
  45.  *  - Spline Builder
  46.  *  - Statistical Learning
  47.  *
  48.  *  Documentation for DROP is Spread Over:
  49.  *
  50.  *  - Main                     => https://lakshmidrip.github.io/DROP/
  51.  *  - Wiki                     => https://github.com/lakshmiDRIP/DROP/wiki
  52.  *  - GitHub                   => https://github.com/lakshmiDRIP/DROP
  53.  *  - Repo Layout Taxonomy     => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
  54.  *  - Javadoc                  => https://lakshmidrip.github.io/DROP/Javadoc/index.html
  55.  *  - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
  56.  *  - Release Versions         => https://lakshmidrip.github.io/DROP/version.html
  57.  *  - Community Credits        => https://lakshmidrip.github.io/DROP/credits.html
  58.  *  - Issues Catalog           => https://github.com/lakshmiDRIP/DROP/issues
  59.  *  - JUnit                    => https://lakshmidrip.github.io/DROP/junit/index.html
  60.  *  - Jacoco                   => https://lakshmidrip.github.io/DROP/jacoco/index.html
  61.  *
  62.  *  Licensed under the Apache License, Version 2.0 (the "License");
  63.  *      you may not use this file except in compliance with the License.
  64.  *  
  65.  *  You may obtain a copy of the License at
  66.  *      http://www.apache.org/licenses/LICENSE-2.0
  67.  *  
  68.  *  Unless required by applicable law or agreed to in writing, software
  69.  *      distributed under the License is distributed on an "AS IS" BASIS,
  70.  *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  71.  *  
  72.  *  See the License for the specific language governing permissions and
  73.  *      limitations under the License.
  74.  */

  75. /**
  76.  * <i>CrossRiskClassCorrelation21</i> contains the SIMM 2.1 Correlation between the Different Risk Classes.
  77.  * The References are:
  78.  *
  79.  * <br><br>
  80.  *  <ul>
  81.  *      <li>
  82.  *          Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Credit Exposure in the Presence of Initial
  83.  *              Margin https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2806156 <b>eSSRN</b>
  84.  *      </li>
  85.  *      <li>
  86.  *          Albanese, C., S. Caenazzo, and O. Frankel (2017): Regression Sensitivities for Initial Margin
  87.  *              Calculations https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2763488 <b>eSSRN</b>
  88.  *      </li>
  89.  *      <li>
  90.  *          Anfuso, F., D. Aziz, P. Giltinan, and K. Loukopoulus (2017): A Sound Modeling and Back-testing
  91.  *              Framework for Forecasting Initial Margin Requirements
  92.  *                  https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2716279 <b>eSSRN</b>
  93.  *      </li>
  94.  *      <li>
  95.  *          Caspers, P., P. Giltinan, R. Lichters, and N. Nowaczyk (2017): Forecasting Initial Margin
  96.  *              Requirements - A Model Evaluation https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2911167
  97.  *                  <b>eSSRN</b>
  98.  *      </li>
  99.  *      <li>
  100.  *          International Swaps and Derivatives Association (2017): SIMM v2.0 Methodology
  101.  *              https://www.isda.org/a/oFiDE/isda-simm-v2.pdf
  102.  *      </li>
  103.  *  </ul>
  104.  *
  105.  * <br><br>
  106.  *  <ul>
  107.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/PortfolioCore.md">Portfolio Core Module</a></li>
  108.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/MarginAnalyticsLibrary.md">Initial and Variation Margin Analytics</a></li>
  109.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/simm/README.md">Initial Margin Analytics based on ISDA SIMM and its Variants</a></li>
  110.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/simm/common/README.md">Common Cross Risk Factor Utilities</a></li>
  111.  *  </ul>
  112.  * <br><br>
  113.  *
  114.  * @author Lakshmi Krishnamurthy
  115.  */

  116. public class CrossRiskClassCorrelation21
  117. {

  118.     /**
  119.      * Correlation between Interest Rate and Credit Qualifying Risk Classes
  120.      */

  121.     public static final double IR_CRQ = 0.25;

  122.     /**
  123.      * Correlation between Interest Rate and Credit Non-Qualifying Risk Classes
  124.      */

  125.     public static final double IR_CRNQ = 0.15;

  126.     /**
  127.      * Correlation between Interest Rate and Equity Risk Classes
  128.      */

  129.     public static final double IR_EQ = 0.19;

  130.     /**
  131.      * Correlation between Interest Rate and Commodity Risk Classes
  132.      */

  133.     public static final double IR_CT = 0.30;

  134.     /**
  135.      * Correlation between Interest Rate and FX Risk Classes
  136.      */

  137.     public static final double IR_FX = 0.26;

  138.     /**
  139.      * Correlation between Credit Qualifying and Credit Non-Qualifying Risk Classes
  140.      */

  141.     public static final double CRQ_CRNQ = 0.26;

  142.     /**
  143.      * Correlation between Credit Qualifying and Equity Risk Classes
  144.      */

  145.     public static final double CRQ_EQ = 0.65;

  146.     /**
  147.      * Correlation between Credit Qualifying and Commodity Risk Classes
  148.      */

  149.     public static final double CRQ_CT = 0.45;

  150.     /**
  151.      * Correlation between Credit Qualifying and FX Risk Classes
  152.      */

  153.     public static final double CRQ_FX = 0.24;

  154.     /**
  155.      * Correlation between Credit Non Qualifying and Equity Risk Classes
  156.      */

  157.     public static final double CRNQ_EQ = 0.17;

  158.     /**
  159.      * Correlation between Credit Non Qualifying and Commodity Risk Classes
  160.      */

  161.     public static final double CRNQ_CT = 0.22;

  162.     /**
  163.      * Correlation between Credit Non Qualifying and FX Risk Classes
  164.      */

  165.     public static final double CRNQ_FX = 0.11;

  166.     /**
  167.      * Correlation between Equity and Commodity Risk Classes
  168.      */

  169.     public static final double EQ_CT = 0.39;

  170.     /**
  171.      * Correlation between Equity and FX Risk Classes
  172.      */

  173.     public static final double EQ_FX = 0.23;

  174.     /**
  175.      * Correlation between Commodity and FX Risk Classes
  176.      */

  177.     public static final double CT_FX = 0.32;

  178.     /**
  179.      * Retrieve the Correlation between Interest Rate and Credit Qualifying Risk Classes
  180.      *
  181.      * @return Correlation between Interest Rate and Credit Qualifying Risk Classes
  182.      */

  183.     public static final double IR_CRQ()
  184.     {
  185.         return IR_CRQ;
  186.     }

  187.     /**
  188.      * Retrieve the Correlation between Interest Rate and Credit Qualifying Risk Classes
  189.      *
  190.      * @return Correlation between Interest Rate and Credit Qualifying Risk Classes
  191.      */

  192.     public static final double CRQ_IR()
  193.     {
  194.         return IR_CRQ;
  195.     }

  196.     /**
  197.      * Retrieve the Correlation between Interest Rate and Credit Non Qualifying Risk Classes
  198.      *
  199.      * @return Correlation between Interest Rate and Credit Non Qualifying Risk Classes
  200.      */

  201.     public static final double IR_CRNQ()
  202.     {
  203.         return IR_CRNQ;
  204.     }

  205.     /**
  206.      * Retrieve the Correlation between Interest Rate and Credit Non Qualifying Risk Classes
  207.      *
  208.      * @return Correlation between Interest Rate and Credit Non Qualifying Risk Classes
  209.      */

  210.     public static final double CRNQ_IR()
  211.     {
  212.         return IR_CRNQ;
  213.     }

  214.     /**
  215.      * Retrieve the Correlation between Interest Rate and Equity Risk Classes
  216.      *
  217.      * @return Correlation between Interest Rate and Equity Risk Classes
  218.      */

  219.     public static final double IR_EQ()
  220.     {
  221.         return IR_EQ;
  222.     }

  223.     /**
  224.      * Retrieve the Correlation between Interest Rate and Equity Risk Classes
  225.      *
  226.      * @return Correlation between Interest Rate and Equity Risk Classes
  227.      */

  228.     public static final double EQ_IR()
  229.     {
  230.         return IR_EQ;
  231.     }

  232.     /**
  233.      * Retrieve the Correlation between Interest Rate and Commodity Risk Classes
  234.      *
  235.      * @return Correlation between Interest Rate and Commodity Risk Classes
  236.      */

  237.     public static final double IR_CT()
  238.     {
  239.         return IR_CT;
  240.     }

  241.     /**
  242.      * Retrieve the Correlation between Interest Rate and Commodity Risk Classes
  243.      *
  244.      * @return Correlation between Interest Rate and Commodity Risk Classes
  245.      */

  246.     public static final double CT_IR()
  247.     {
  248.         return IR_CT;
  249.     }

  250.     /**
  251.      * Retrieve the Correlation between Interest Rate and FX Risk Classes
  252.      *
  253.      * @return Correlation between Interest Rate and FX Risk Classes
  254.      */

  255.     public static final double IR_FX()
  256.     {
  257.         return IR_FX;
  258.     }

  259.     /**
  260.      * Retrieve the Correlation between Interest Rate and FX Risk Classes
  261.      *
  262.      * @return Correlation between Interest Rate and FX Risk Classes
  263.      */

  264.     public static final double FX_IR()
  265.     {
  266.         return IR_FX;
  267.     }

  268.     /**
  269.      * Retrieve the Correlation between Credit Qualifying and Credit Non-Qualifying Risk Classes
  270.      *
  271.      * @return Correlation between Credit Qualifying and Credit Non-Qualifying Risk Classes
  272.      */

  273.     public static final double CRQ_CRNQ()
  274.     {
  275.         return CRQ_CRNQ;
  276.     }

  277.     /**
  278.      * Retrieve the Correlation between Credit Qualifying and Credit Non-Qualifying Risk Classes
  279.      *
  280.      * @return Correlation between Credit Qualifying and Credit Non-Qualifying Risk Classes
  281.      */

  282.     public static final double CNRQ_CNQ()
  283.     {
  284.         return CRQ_CRNQ;
  285.     }

  286.     /**
  287.      * Retrieve the Correlation between Credit Qualifying and Equity Risk Classes
  288.      *
  289.      * @return Correlation between Credit Qualifying and Equity Risk Classes
  290.      */

  291.     public static final double CRQ_EQ()
  292.     {
  293.         return CRQ_EQ;
  294.     }

  295.     /**
  296.      * Retrieve the Correlation between Credit Qualifying and Equity Risk Classes
  297.      *
  298.      * @return Correlation between Credit Qualifying and Equity Risk Classes
  299.      */

  300.     public static final double EQ_CRQ()
  301.     {
  302.         return CRQ_EQ;
  303.     }

  304.     /**
  305.      * Retrieve the Correlation between Credit Qualifying and Commodity Risk Classes
  306.      *
  307.      * @return Correlation between Credit Qualifying and Commodity Risk Classes
  308.      */

  309.     public static final double CRQ_CT()
  310.     {
  311.         return CRQ_CT;
  312.     }

  313.     /**
  314.      * Retrieve the Correlation between Credit Qualifying and Commodity Risk Classes
  315.      *
  316.      * @return Correlation between Credit Qualifying and Commodity Risk Classes
  317.      */

  318.     public static final double CT_CRQ()
  319.     {
  320.         return CRQ_CT;
  321.     }

  322.     /**
  323.      * Retrieve the Correlation between Credit Qualifying and FX Risk Classes
  324.      *
  325.      * @return Correlation between Credit Qualifying and FX Risk Classes
  326.      */

  327.     public static final double CRQ_FX()
  328.     {
  329.         return CRQ_FX;
  330.     }

  331.     /**
  332.      * Retrieve the Correlation between Credit Qualifying and FX Risk Classes
  333.      *
  334.      * @return Correlation between Credit Qualifying and FX Risk Classes
  335.      */

  336.     public static final double FX_CRQ()
  337.     {
  338.         return CRQ_FX;
  339.     }

  340.     /**
  341.      * Retrieve the Correlation between Credit Non Qualifying and Equity Risk Classes
  342.      *
  343.      * @return Correlation between Credit Non Qualifying and Equity Risk Classes
  344.      */

  345.     public static final double CNRQ_EQ()
  346.     {
  347.         return CRNQ_EQ;
  348.     }

  349.     /**
  350.      * Retrieve the Correlation between Credit Non Qualifying and Equity Risk Classes
  351.      *
  352.      * @return Correlation between Credit Non Qualifying and Equity Risk Classes
  353.      */

  354.     public static final double EQ_CNRQ()
  355.     {
  356.         return CRNQ_EQ;
  357.     }

  358.     /**
  359.      * Retrieve the Correlation between Credit Non Qualifying and Commodity Risk Classes
  360.      *
  361.      * @return Correlation between Credit Non Qualifying and Commodity Risk Classes
  362.      */

  363.     public static final double CNRQ_CT()
  364.     {
  365.         return CRNQ_CT;
  366.     }

  367.     /**
  368.      * Retrieve the Correlation between Credit Non Qualifying and Commodity Risk Classes
  369.      *
  370.      * @return Correlation between Credit Non Qualifying and Commodity Risk Classes
  371.      */

  372.     public static final double CT_CNRQ()
  373.     {
  374.         return CRNQ_CT;
  375.     }

  376.     /**
  377.      * Retrieve the Correlation between Credit Non Qualifying and FX Risk Classes
  378.      *
  379.      * @return Correlation between Credit Non Qualifying and FX Risk Classes
  380.      */

  381.     public static final double CreditNonQualifying_FX()
  382.     {
  383.         return CRNQ_FX;
  384.     }

  385.     /**
  386.      * Retrieve the Correlation between Credit Non Qualifying and FX Risk Classes
  387.      *
  388.      * @return Correlation between Credit Non Qualifying and FX Risk Classes
  389.      */

  390.     public static final double FX_CNRQ()
  391.     {
  392.         return CRNQ_FX;
  393.     }

  394.     /**
  395.      * Retrieve the Correlation between Equity and Commodity Risk Classes
  396.      *
  397.      * @return Correlation between Equity and Commodity Risk Classes
  398.      */

  399.     public static final double EQ_CT()
  400.     {
  401.         return EQ_CT;
  402.     }

  403.     /**
  404.      * Retrieve the Correlation between Equity and Commodity Risk Classes
  405.      *
  406.      * @return Correlation between Equity and Commodity Risk Classes
  407.      */

  408.     public static final double CT_EQ()
  409.     {
  410.         return EQ_CT;
  411.     }

  412.     /**
  413.      * Retrieve the Correlation between Equity and FX Risk Classes
  414.      *
  415.      * @return Correlation between Equity and FX Risk Classes
  416.      */

  417.     public static final double EQ_FX()
  418.     {
  419.         return EQ_FX;
  420.     }

  421.     /**
  422.      * Retrieve the Correlation between Equity and FX Risk Classes
  423.      *
  424.      * @return Correlation between Equity and FX Risk Classes
  425.      */

  426.     public static final double FX_EQ()
  427.     {
  428.         return EQ_FX;
  429.     }

  430.     /**
  431.      * Retrieve the Correlation between Commodity and FX Risk Classes
  432.      *
  433.      * @return Correlation between Commodity and FX Risk Classes
  434.      */

  435.     public static final double CT_FX()
  436.     {
  437.         return CT_FX;
  438.     }

  439.     /**
  440.      * Retrieve the Correlation between Commodity and FX Risk Classes
  441.      *
  442.      * @return Correlation between Commodity and FX Risk Classes
  443.      */

  444.     public static final double FX_CT()
  445.     {
  446.         return CT_FX;
  447.     }

  448.     /**
  449.      * Generate the Corresponding Risk Class Correlation Matrix as a LabelCorrelation Instance
  450.      *
  451.      * @return The Risk Class Correlation Matrix
  452.      */

  453.     public static final org.drip.measure.stochastic.LabelCorrelation Matrix()
  454.     {
  455.         double[][] riskClassCorrelationMatrix = new double[6][6];

  456.         for (int i = 0 ; i < 6; ++i)
  457.         {
  458.             riskClassCorrelationMatrix[i][i] = 1.;
  459.         }

  460.         riskClassCorrelationMatrix[0][1] = IR_CRQ;
  461.         riskClassCorrelationMatrix[1][0] = IR_CRQ;
  462.         riskClassCorrelationMatrix[0][2] = IR_CRNQ;
  463.         riskClassCorrelationMatrix[2][0] = IR_CRNQ;
  464.         riskClassCorrelationMatrix[0][3] = IR_EQ;
  465.         riskClassCorrelationMatrix[3][0] = IR_EQ;
  466.         riskClassCorrelationMatrix[0][4] = IR_CT;
  467.         riskClassCorrelationMatrix[4][0] = IR_CT;
  468.         riskClassCorrelationMatrix[0][5] = IR_FX;
  469.         riskClassCorrelationMatrix[5][0] = IR_FX;

  470.         riskClassCorrelationMatrix[1][2] = CRQ_CRNQ;
  471.         riskClassCorrelationMatrix[2][1] = CRQ_CRNQ;
  472.         riskClassCorrelationMatrix[1][3] = CRQ_EQ;
  473.         riskClassCorrelationMatrix[3][1] = CRQ_EQ;
  474.         riskClassCorrelationMatrix[1][4] = CRQ_CT;
  475.         riskClassCorrelationMatrix[4][1] = CRQ_CT;
  476.         riskClassCorrelationMatrix[1][5] = CRQ_FX;
  477.         riskClassCorrelationMatrix[5][1] = CRQ_FX;

  478.         riskClassCorrelationMatrix[2][3] = CRNQ_EQ;
  479.         riskClassCorrelationMatrix[3][2] = CRNQ_EQ;
  480.         riskClassCorrelationMatrix[2][4] = CRNQ_CT;
  481.         riskClassCorrelationMatrix[4][2] = CRNQ_CT;
  482.         riskClassCorrelationMatrix[2][5] = CRNQ_FX;
  483.         riskClassCorrelationMatrix[5][2] = CRNQ_FX;

  484.         riskClassCorrelationMatrix[3][4] = EQ_CT;
  485.         riskClassCorrelationMatrix[4][3] = EQ_CT;
  486.         riskClassCorrelationMatrix[3][5] = EQ_FX;
  487.         riskClassCorrelationMatrix[5][3] = EQ_FX;

  488.         riskClassCorrelationMatrix[4][5] = CT_FX;
  489.         riskClassCorrelationMatrix[5][4] = CT_FX;

  490.         java.util.List<java.lang.String> chargramList = new java.util.ArrayList<java.lang.String>();

  491.         chargramList.add (org.drip.simm.common.Chargram.IR);

  492.         chargramList.add (org.drip.simm.common.Chargram.CRQ);

  493.         chargramList.add (org.drip.simm.common.Chargram.CRNQ);

  494.         chargramList.add (org.drip.simm.common.Chargram.EQ);

  495.         chargramList.add (org.drip.simm.common.Chargram.CT);

  496.         chargramList.add (org.drip.simm.common.Chargram.FX);

  497.         try
  498.         {
  499.             return new org.drip.measure.stochastic.LabelCorrelation (
  500.                 chargramList,
  501.                 riskClassCorrelationMatrix
  502.             );
  503.         }
  504.         catch (java.lang.Exception e)
  505.         {
  506.             e.printStackTrace();
  507.         }

  508.         return null;
  509.     }
  510. }