Re: [ojAlgo-user] MarkowitzModel and MarketEquilibrium
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anders P. <an...@op...> - 2016-09-12 18:17:40
|
> On 11 sep. 2016, at 20:23, Max Muraz <mx....@gm...> wrote: > > I have finished a part of my tests between Version 37 and 40.0.4 . > Here are my results. > > The 40.0.4 version had performance problems with covariance matrix not positive define. Version 37 not. > I don't knew that I had to pass as input a matrix positive define. A positive (semi) definite covariance matrix has always been a requirement. The underlying optimisation solvers do however try to be lenient and return a solution if at all possible. It seems earlier versions were more forgiving, and I’m not sure exactly what to do to restore that. In finance a covariance matrix should be positive definite for other/more reasons. Negative eigenvalues implies negative risk, and that’s not possible. Using historical data to calculate returns, correlations and covariances does not produce a god given truth. > To test if matrix is positive define I used the Cholesky Decomposition and in case that the matrix is not positive definite I tried using MarketEquilibrium.clean ( ). Why not always clean the covariance matrix? … or assert nonnegative eigenvalues some other way. > I sent as attachments .txt files that I used as parameters of MarketEquilibrium and MarkowitzModel class, including result weight vectors for both version 37 and 40.0.4, the results are very closed, but different, in the 40.0.4 version there are also negative and very small elements. The weights from v37 looks a little too perfect to come straight from the solver. They must have been rounded somewhere along the way. The MarkowitzModel does (again) contain a filter to remove negative weights, but other rounding errors from the solver are propagated as is. (I thought v40.0.4 had that filter already, but I’ve now uploaded v40.0.5.) If you call the normalise() method on any FinancePortfolio instance you’ll get nicely rounded weights that sum to 1.0 exactly. /Anders > I hope it is of your interest. > Thank you for your kind help and support. > > Max Muraz > > <0_CovarianceMatrix.txt><0_ExpectedReturns.txt><0_Limits.txt><0_RiskAversionFactor.txt><37_Results.txt><40_Results.txt>------------------------------------------------------------------------------ > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |