Class MarketEquilibrium
java.lang.Object
org.ojalgo.data.domain.finance.portfolio.MarketEquilibrium
MarketEquilibrium translates between the market portfolio weights and the equilibrium excess returns. The only things needed to do those translations are the covariance matrix and the (market) risk aversion factor - that's what you need to supply when you instantiate this class.
This class performs unconstrained optimisation. For each set of asset returns there is an optimal set of weights. It also performs reverse (unconstrained) optimisation producing the "optimal" expected returns given a set of weights.
The name MarketEquilibrium is actually a bit misleading. By altering the risk aversion factor this class can/will describe the weights/returns equilibrium for any investor.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final BigDecimal
private final String[]
private final MatrixR064
private BigDecimal
private static final String
private static final String
-
Constructor Summary
ConstructorsConstructorDescriptionMarketEquilibrium
(String[] assetNamesOrKeys, Access2D<?> covarianceMatrix) MarketEquilibrium
(String[] assetNamesOrKeys, Access2D<?> covarianceMatrix, Comparable<?> riskAversionFactor) MarketEquilibrium
(MarketEquilibrium marketEquilibrium) MarketEquilibrium
(Access2D<?> covarianceMatrix) MarketEquilibrium
(Access2D<?> covarianceMatrix, Comparable<?> riskAversionFactor) -
Method Summary
Modifier and TypeMethodDescriptioncalculateAssetReturns
(MatrixR064 assetWeights) If the input vector of asset weights are the weights of the market portfolio, then the ouput is the equilibrium excess returns.calculateAssetWeights
(MatrixR064 assetReturns) If the input vector of returns are the equilibrium excess returns then the output is the market portfolio weights.(package private) Scalar
<?> calculateImpliedRiskAversion
(MatrixR064 assetWeights, MatrixR064 assetReturns) Will calculate the risk aversion factor that is the best fit for an observed pair of market portfolio weights and equilibrium/historical excess returns.static Scalar
<?> calculatePortfolioReturn
(MatrixR064 assetWeights, MatrixR064 assetReturns) Calculates the portfolio return using the input asset weights and returns.Scalar
<?> calculatePortfolioVariance
(MatrixR064 assetWeights) Calculates the portfolio variance using the input instrument weights.void
calibrate
(MatrixR064 assetWeights, MatrixR064 assetReturns) Will set the risk aversion factor to the best fit for an observed pair of market portfolio asset weights and equilibrium/historical excess returns.clean()
Equivalent to copying, but additionally the covariance matrix will be cleaned of negative and very small eigenvalues to make it positive definite.copy()
getAssetKey
(int index) String[]
Scalar
<?> (package private) boolean
private static String[]
makeSymbols
(int count) void
setRiskAversion
(Comparable<?> factor) int
size()
-
Field Details
-
DEFAULT_RISK_AVERSION
-
STRING_ZERO
- See Also:
-
SYMBOL
- See Also:
-
myAssetKeys
-
myCovariances
-
myRiskAversion
-
-
Constructor Details
-
MarketEquilibrium
-
MarketEquilibrium
-
MarketEquilibrium
-
MarketEquilibrium
public MarketEquilibrium(String[] assetNamesOrKeys, Access2D<?> covarianceMatrix, Comparable<?> riskAversionFactor) -
MarketEquilibrium
MarketEquilibrium(MarketEquilibrium marketEquilibrium)
-
-
Method Details
-
calculatePortfolioReturn
Calculates the portfolio return using the input asset weights and returns. -
makeSymbols
-
calculateAssetReturns
If the input vector of asset weights are the weights of the market portfolio, then the ouput is the equilibrium excess returns. -
calculateAssetWeights
If the input vector of returns are the equilibrium excess returns then the output is the market portfolio weights. This is unconstrained optimisation - there are no constraints on the resulting instrument weights. -
calculatePortfolioVariance
Calculates the portfolio variance using the input instrument weights. -
calibrate
Will set the risk aversion factor to the best fit for an observed pair of market portfolio asset weights and equilibrium/historical excess returns. -
clean
Equivalent to copying, but additionally the covariance matrix will be cleaned of negative and very small eigenvalues to make it positive definite. -
copy
-
getAssetKey
-
getAssetKeys
-
getCovariances
-
getRiskAversion
-
setRiskAversion
-
size
public int size() -
toCorrelations
-
calculateImpliedRiskAversion
Will calculate the risk aversion factor that is the best fit for an observed pair of market portfolio weights and equilibrium/historical excess returns. -
isDefaultRiskAversion
boolean isDefaultRiskAversion()
-