ggiecold-zz / pyrmt Goto Github PK
View Code? Open in Web Editor NEWPython for Random Matrix Theory: cleaning schemes for noisy correlation matrices.
License: MIT License
Python for Random Matrix Theory: cleaning schemes for noisy correlation matrices.
License: MIT License
After applying the algorithm to very small portfolio of ~15 assets, I noticed that the covariance is very underestimated. For instance, correlation between MSCI WLD and S&P 500 was negative (!!)
Mean absolute error on cross validation on my data was 0.41.
After reviewing the literature, most notably https://arxiv.org/pdf/1610.08104.pdf : see 8.1.2. Regularizing the empirical RIE,There exists a regularization technique called Invesrse Wishart, that would correct estimation error on the smallest eigenvalues:
kappa=2*lambda_N/((1-q-lambda_N)**2-4*q*lambda_N) alpha_s=1/(1+2*q*kappa) denom=x/(1+alpha_s*(x-1.)) Gamma /= denom
After applying this technique, MAE on my sample fell to 0.381, and correlation between WLD and S&P went back to 0.73. Markowitz optimization was also improved.
Errors are still much worse than a regular empirical or scikit MinCovDet estimator.
Please advise.
I might be mistaken, but I think the code on https://github.com/GGiecold/pyRMT/blob/master/pyRMT.py#L452-L455 does not reflect what is written in the green Box 1. on the last page of one of the referenced papers: https://www.cfm.fr/assets/ResearchPapers/2016-Cleaning-Correlation-Matrices.pdf
I think that
gmp = z + sigma_2 * (q - 1) - np.sqrt((z - lambda_N) * (z - lambda_plus))
should be
gmp = z + sigma_2 * (q - 1) - np.sqrt(z - lambda_N) * np.sqrt(z - lambda_plus)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.