org.akutan.blacklitterman
Class KrishnanMains

java.lang.Object
  extended by org.akutan.blacklitterman.BlackLitterman
      extended by org.akutan.blacklitterman.KrishnanMains

public class KrishnanMains
extends BlackLitterman

Provides test data and harness to reproduce the results from the Krishnan & Mains 2 factor Black-Litterman paper published in Risk magazine. Current status is that given the fact that the paper only provides summary statistics one can only start with those and run through the math.

Since:
March 10, 2007

Field Summary
 
Fields inherited from class org.akutan.blacklitterman.BlackLitterman
modifyVariance
 
Constructor Summary
KrishnanMains()
           
 
Method Summary
 cern.colt.matrix.DoubleMatrix1D getAdjustedPi_Risk()
          Returns the post factor Pi vector from the paper for checking to results.
 cern.colt.matrix.DoubleMatrix1D getAdjustedPi()
          Returns the post factor Pi vector from the paper for checking to results.
 java.lang.String[] getAssetNames()
          Returns the asset names used to test Krishnan-Mains
 cern.colt.matrix.DoubleMatrix1D getBetas_Risk()
          Returns the betas to the recession factor from the example in the Krishnan-Mains paper
 cern.colt.matrix.DoubleMatrix1D getBetas()
          Returns the betas to the recession factor from the example in the Krishnan-Mains paper
protected  cern.colt.matrix.DoubleMatrix1D getDelta(cern.colt.matrix.DoubleMatrix1D pi, cern.colt.matrix.DoubleMatrix2D V, cern.colt.matrix.DoubleMatrix1D w, cern.colt.matrix.DoubleMatrix2D rw, cern.colt.matrix.DoubleMatrix1D rF, cern.colt.matrix.DoubleMatrix2D beta)
          A first attempt at the multi-factor getDelta() method.
 cern.colt.matrix.DoubleMatrix1D getEquilibriumReturns_Risk()
          Returns the equilibrium returns from the paper
 cern.colt.matrix.DoubleMatrix1D getEquilibriumReturns()
          Returns the equilibrium returns from the paper
 cern.colt.matrix.DoubleMatrix1D getMarketWeights()
          Returns the market weights from the example shown in the Krishnan-Mains paper on 2 factor Black-Litterman.
 cern.colt.matrix.DoubleMatrix1D getReplWeights_Risk()
          Returns the weights of the replicating portfolio from the paper.
 cern.colt.matrix.DoubleMatrix1D getReplWeights()
          Returns the weights of the replicating portfolio from the paper.
 cern.colt.matrix.DoubleMatrix2D getTestV()
          Returns the covariance matrix for the example shown in the Krishnan & Mains paper on 2 factor Black-Litterman.
protected  cern.colt.matrix.DoubleMatrix1D getUpdatedPi(cern.colt.matrix.DoubleMatrix1D pi, cern.colt.matrix.DoubleMatrix2D beta, cern.colt.matrix.DoubleMatrix1D delta)
          Given a matrix of betas of the assets and factors, and the vector of deltas, computes a new adjusted vector of equilibrium asset returns.
static void main(java.lang.String[] args)
          This program matches the results from the preliminary copy of the Krishnan and Mains paper which can be found on the internet.
protected static java.lang.String print(java.text.DecimalFormat df, cern.colt.matrix.DoubleMatrix1D d)
          Helper function to return formatted print of vector
 cern.colt.matrix.DoubleMatrix2D transpose(cern.colt.matrix.DoubleMatrix1D d)
          Helper function to transpose a 1D matrix into a 2D matrix
 
Methods inherited from class org.akutan.blacklitterman.BlackLitterman
applyBL, applyBL, computeDelta, computeEr, computeImpliedWeights, computeInterval, computeKLIC, computeLambda, computeLambdaN, computePartialTevSensitities, computeTev, computeTevSensitities, computeV, getViewVariance, isModifyVariance, maxValue, mehalanobisDistance, overallProbability, reverseOptimize, sensitivities, setModifyVariance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KrishnanMains

public KrishnanMains()
Method Detail

getMarketWeights

public cern.colt.matrix.DoubleMatrix1D getMarketWeights()
Returns the market weights from the example shown in the Krishnan-Mains paper on 2 factor Black-Litterman.

Returns:
Vector of market weights for the assets.

getTestV

public cern.colt.matrix.DoubleMatrix2D getTestV()
Returns the covariance matrix for the example shown in the Krishnan & Mains paper on 2 factor Black-Litterman.

Returns:
Covariance matrix for the assets

getEquilibriumReturns

public cern.colt.matrix.DoubleMatrix1D getEquilibriumReturns()
Returns the equilibrium returns from the paper

Returns:
Vector of equilibrium returns from the example

getEquilibriumReturns_Risk

public cern.colt.matrix.DoubleMatrix1D getEquilibriumReturns_Risk()
Returns the equilibrium returns from the paper

Returns:
Vector of standard deviation of the returns for each asset from the paper.

getAssetNames

public java.lang.String[] getAssetNames()
Returns the asset names used to test Krishnan-Mains

Returns:
Array of the asset names

getBetas

public cern.colt.matrix.DoubleMatrix1D getBetas()
Returns the betas to the recession factor from the example in the Krishnan-Mains paper

Returns:
Vector of betas of the assets to the recession factor

getBetas_Risk

public cern.colt.matrix.DoubleMatrix1D getBetas_Risk()
Returns the betas to the recession factor from the example in the Krishnan-Mains paper

Returns:
The risk based on the betas (Check this TODO)

getAdjustedPi

public cern.colt.matrix.DoubleMatrix1D getAdjustedPi()
Returns the post factor Pi vector from the paper for checking to results.

Returns:
Adjusted returns (after adjustment for recession factor)

getAdjustedPi_Risk

public cern.colt.matrix.DoubleMatrix1D getAdjustedPi_Risk()
Returns the post factor Pi vector from the paper for checking to results.

Returns:
Vector of standard deviation of returns after adjusting for the recession factor.

getReplWeights

public cern.colt.matrix.DoubleMatrix1D getReplWeights()
Returns the weights of the replicating portfolio from the paper.

Returns:
Vector of weights of the recession factor replicating portfolio.

getReplWeights_Risk

public cern.colt.matrix.DoubleMatrix1D getReplWeights_Risk()
Returns the weights of the replicating portfolio from the paper.

Returns:
Returns the

transpose

public cern.colt.matrix.DoubleMatrix2D transpose(cern.colt.matrix.DoubleMatrix1D d)
Helper function to transpose a 1D matrix into a 2D matrix

Parameters:
d - input vector
Returns:
Matrix containing vector d in single row.

getDelta

protected cern.colt.matrix.DoubleMatrix1D getDelta(cern.colt.matrix.DoubleMatrix1D pi,
                                                   cern.colt.matrix.DoubleMatrix2D V,
                                                   cern.colt.matrix.DoubleMatrix1D w,
                                                   cern.colt.matrix.DoubleMatrix2D rw,
                                                   cern.colt.matrix.DoubleMatrix1D rF,
                                                   cern.colt.matrix.DoubleMatrix2D beta)
A first attempt at the multi-factor getDelta() method. I know that this returns the correct result for a second factor, but it probably doesn't work right for a third or higher factor. TODO Fix this so it is correct for three or more factors.

Parameters:
pi - Vector of Asset returns
V - Asset covariance matrix
w - Vector of equilibrium weights of the assets
rw - Matrix of replicating weights for each factor
rF - Vector of Factor returns
beta - Matrix of betas between the assets and the factors
Returns:
Vector of delta values for each factor (delta[0] is the standard Black-Litterman delta value).

getUpdatedPi

protected cern.colt.matrix.DoubleMatrix1D getUpdatedPi(cern.colt.matrix.DoubleMatrix1D pi,
                                                       cern.colt.matrix.DoubleMatrix2D beta,
                                                       cern.colt.matrix.DoubleMatrix1D delta)
Given a matrix of betas of the assets and factors, and the vector of deltas, computes a new adjusted vector of equilibrium asset returns. There might be a cleaner vector expression, but the iterative one works.

Parameters:
pi - Vector of asset returns
beta - Matrix of betas between the assets and the various factors
delta - Vector of delta values by factor (delta[0] = Black-Litterman delta)
Returns:
Updated vector of equilibrium asset returns after adjusting for the impact of the recession factor.

print

protected static java.lang.String print(java.text.DecimalFormat df,
                                        cern.colt.matrix.DoubleMatrix1D d)
Helper function to return formatted print of vector

Parameters:
df - Format to use for numbers
d - Vector to be formatted
Returns:
String version of the vector formatted as specified.

main

public static void main(java.lang.String[] args)
This program matches the results from the preliminary copy of the Krishnan and Mains paper which can be found on the internet.

Parameters:
args - Command line arguments (ignored).