IdzorekAndrogue2003.java

  1. package org.drip.sample.blacklitterman;

  2. import org.drip.numerical.common.FormatUtil;
  3. import org.drip.numerical.linearalgebra.Matrix;
  4. import org.drip.service.env.EnvManager;

  5. /*
  6.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  7.  */

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

  80. /**
  81.  * <i>IdzorekAndrogue2003</i> reconciles the Outputs of the Black-Litterman Model Process. The References
  82.  * are:
  83.  *  
  84.  * <br><br>
  85.  *  <ul>
  86.  *      <li>
  87.  *          He. G., and R. Litterman (1999): <i>The Intuition behind the Black-Litterman Model Portfolios</i>
  88.  *              <b>Goldman Sachs Asset Management</b>
  89.  *      </li>
  90.  *      <li>
  91.  *          Idzorek, T., and J. Androgue (2003):
  92.  *              https://faculty.fuqua.duke.edu/~charvey/Teaching/BA453_2005/Black%20Litterman.pdf
  93.  *      </li>
  94.  *  </ul>
  95.  *  
  96.  * <br><br>
  97.  *  <ul>
  98.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ProductCore.md">Product Core Module</a></li>
  99.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/TransactionCostAnalyticsLibrary.md">Transaction Cost Analytics</a></li>
  100.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/README.md">DROP API Construction and Usage</a></li>
  101.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/blacklitterman/README.md">Canonical Black Litterman and Extensions</a></li>
  102.  *  </ul>
  103.  * <br><br>
  104.  *
  105.  * @author Lakshmi Krishnamurthy
  106.  */

  107. public class IdzorekAndrogue2003 {

  108.     public static final void main (
  109.         final String[] astArgs)
  110.         throws Exception
  111.     {
  112.         EnvManager.InitEnv (
  113.             "",
  114.             true
  115.         );

  116.         String[] astrAssetClass = new String[] {
  117.             "US Bonds            ",
  118.             "Global Bonds xUSD   ",
  119.             "World Equity xUS    ",
  120.             "Emerging Equity     ",
  121.             "US Large Cap Growth ",
  122.             "US Large Cap Value  ",
  123.             "US Small Cap Growth ",
  124.             "US Small Cap Value  "
  125.         };

  126.         double[] adblMarketCapitalizationEstimate = new double[] {
  127.              8360741000000.,
  128.             11583275710000.,
  129.              9212460000000.,
  130.               964647000000.,
  131.              5217844438500.,
  132.              5217844438500.,
  133.               459897061500.,
  134.               459897061500.
  135.         };

  136.         double dblDelta = 3.37;

  137.         double[][] aadblAssetExcessReturnsCorrelation = new double[][] {
  138.             { 0.0014,  0.0015, -0.0008, -0.0017, -0.0010, -0.0007, -0.0015, -0.0006},
  139.             { 0.0015,  0.0076,  0.0026, -0.0006, -0.0013, -0.0003, -0.0002,  0.0005},
  140.             {-0.0008,  0.0026,  0.0251,  0.0292,  0.0208,  0.0147,  0.0248,  0.0134},
  141.             {-0.0017, -0.0006,  0.0292,  0.0663,  0.0359,  0.0244,  0.0490,  0.0268},
  142.             {-0.0010, -0.0013,  0.0208,  0.0359,  0.0468,  0.0283,  0.0520,  0.0260},
  143.             {-0.0007, -0.0003,  0.0147,  0.0244,  0.0283,  0.0252,  0.0314,  0.0215},
  144.             {-0.0015, -0.0002,  0.0248,  0.0490,  0.0520,  0.0314,  0.0809,  0.0411},
  145.             {-0.0006,  0.0005,  0.0134,  0.0268,  0.0260,  0.0215,  0.0411,  0.0276}
  146.         };

  147.         double[] adblMarketCapitalizationWeightReconciler = new double[] {
  148.             0.2016,
  149.             0.2793,
  150.             0.2221,
  151.             0.0233,
  152.             0.1258,
  153.             0.1258,
  154.             0.0111,
  155.             0.0111
  156.         };

  157.         double[] adblImpliedReturnsReconciler = new double[] {
  158.             0.0008,
  159.             0.0094,
  160.             0.0395,
  161.             0.0537,
  162.             0.0513,
  163.             0.0368,
  164.             0.0612,
  165.             0.0349
  166.         };

  167.         double dblTotalMarketCapitalization = 0.;
  168.         double[] adblMarketCapitalizationWeight = new double[adblMarketCapitalizationEstimate.length];

  169.         for (int i = 0; i < adblMarketCapitalizationEstimate.length; ++i)
  170.             dblTotalMarketCapitalization += adblMarketCapitalizationEstimate[i];

  171.         for (int i = 0; i < adblMarketCapitalizationEstimate.length; ++i)
  172.             adblMarketCapitalizationWeight[i] = adblMarketCapitalizationEstimate[i] / dblTotalMarketCapitalization;

  173.         double[] adblImpliedReturns = Matrix.Product (
  174.             aadblAssetExcessReturnsCorrelation,
  175.             adblMarketCapitalizationWeight
  176.         );

  177.         System.out.println ("\n\t|------------------------------------------------------------------------------------------------------||");

  178.         System.out.println ("\t|                                          CO-VARIANCE MATRIX                                          ||");

  179.         System.out.println ("\t|------------------------------------------------------------------------------------------------------||");

  180.         for (int i = 0; i < astrAssetClass.length; ++i) {
  181.             String strDump = "\t| " + astrAssetClass[i] + " ";

  182.             for (int j = 0; j < astrAssetClass.length; ++j)
  183.                 strDump += "| " + FormatUtil.FormatDouble (aadblAssetExcessReturnsCorrelation[i][j], 1, 4, 1.) + " ";

  184.             System.out.println (strDump + "||");
  185.         }

  186.         System.out.println ("\t|------------------------------------------------------------------------------------------------------||");

  187.         System.out.println ("\n\t||-------------------------------------------------------------||");

  188.         System.out.println ("\t||         MARKET CAPITALIZATION AND EQUILIBRIUM WEIGHTS       ||");

  189.         System.out.println ("\t||-------------------------------------------------------------||");

  190.         System.out.println ("\t||     ASSET CLASS      =>  CAPITALIZATION |  OUTPUT |  PAPER  ||");

  191.         System.out.println ("\t||-------------------------------------------------------------||");

  192.         for (int i = 0; i < adblMarketCapitalizationEstimate.length; ++i)
  193.             System.out.println (
  194.                 "\t|| " + astrAssetClass[i] + " => " +
  195.                 FormatUtil.FormatDouble (adblMarketCapitalizationEstimate[i], 14, 0, 1.) + " | " +
  196.                 FormatUtil.FormatDouble (adblMarketCapitalizationWeight[i], 2, 2, 100.) + "% | " +
  197.                 FormatUtil.FormatDouble (adblMarketCapitalizationWeightReconciler[i], 2, 2, 100.) + "% ||"
  198.             );

  199.         System.out.println ("\t||-------------------------------------------------------------||\n");

  200.         System.out.println ("\t||-------------------------------------------||");

  201.         System.out.println ("\t||         RISK PREMIUM IMPLIED RETURNS      ||");

  202.         System.out.println ("\t||-------------------------------------------||");

  203.         System.out.println ("\t||     ASSET CLASS      =>  OUTPUT |  PAPER  ||");

  204.         System.out.println ("\t||-------------------------------------------||");

  205.         for (int i = 0; i < adblImpliedReturns.length; ++i)
  206.             System.out.println (
  207.                 "\t|| " + astrAssetClass[i] + " => " +
  208.                 FormatUtil.FormatDouble (dblDelta * adblImpliedReturns[i], 2, 2, 100.) + "% | " +
  209.                 FormatUtil.FormatDouble (adblImpliedReturnsReconciler[i], 2, 2, 100.) + "% ||"
  210.             );

  211.         System.out.println ("\t||-------------------------------------------||\n");

  212.         EnvManager.TerminateEnv();
  213.     }
  214. }