P. 1
Matlab - Spectral Decomposition of Correlation Matrix

Matlab - Spectral Decomposition of Correlation Matrix

4.67

|Views: 3,548|Likes:
Published by api-3784429
Monte Carlo simulation would require this correlation to reflect in the random numbers, requiring Choleskey decomposition of the correlation matrix. This however fails if the correlation matrix is not positive semi-definite. Common reasons include noise in the historical data and external stressing applied by the risk manager. The following Matlab code utilises spectral decomposition, suggested by Jackel & Rebonato, to modify the correlation matrix.
Monte Carlo simulation would require this correlation to reflect in the random numbers, requiring Choleskey decomposition of the correlation matrix. This however fails if the correlation matrix is not positive semi-definite. Common reasons include noise in the historical data and external stressing applied by the risk manager. The following Matlab code utilises spectral decomposition, suggested by Jackel & Rebonato, to modify the correlation matrix.

More info:

Published by: api-3784429 on Oct 17, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

%reference %the most general methodology to create a valid correlation matrix for risk management and option pricing

purposes %riccardo rebonato, peter j�ackel, quantitative research centre of the natwest group, 19 th october 1999 %http://www.quarchome.org/correlationmatrix.pdf n=40; %generating random correlation matrix k=(rand(n)*2-1); k=(k+k')/2; c=k.*not(eye(n))+eye(n) unity %dimension of the correlation matrix %random symmetric matrix %principal diagonal elements set to

%spectral decomposition [cvec, cval]=eig(c); %original eigenvectors and eigenvalues stored cval_colvector=eig(c); %eigenvales in a column vector postest=cval_colvector>=0 %testing if all eigenvalues are non-negative %cval_colvector_cor=cval_colvector.*postest; %setting -ve eigenvalues to zero cval_colvector_cor=cval_colvector.*postest + (not(postest)*0.00000001); %setting -ve eigenvalues to a very small positive value cval_cor=cval_colvector_cor*ones(1, n).*eye(n); %corrected eigenvalue matrix bdash=cvec.*((ones(n)*cval_cor).^0.5); "square root of" individual corrected eigenvalues. b=bdash./repmat(sum((bdash.^2),2).^0.5, 1, n); vectors of unit length cdash=b*b' %eigenvector scaled by %normalized to have row

%simpler alternate approach to above three lines t=repmat(sum(cvec.*cvec.*repmat(cval_colvector_cor', n, 1), 2).^(-1), 1, n).*eye(n); %diagonal scaling matrix b_alternate=(t.^0.5)*cvec*(cval_cor.^0.5); cdash_alternate=b_alternate*b_alternate'; chol(cdash)

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->