Functions of Matrices and Nearest Correlation Matrices - NAG

54
Functions of Matrices and Nearest Correlation Matrices Nick Higham School of Mathematics The University of Manchester [email protected] http://www.ma.man.ac.uk/~higham/ NAG Quant Event, New York, Dec 7, 2011

Transcript of Functions of Matrices and Nearest Correlation Matrices - NAG

Page 1: Functions of Matrices and Nearest Correlation Matrices - NAG

Research Matters

February 25 2009

Nick HighamDirector of Research

School of Mathematics

1 6

Functions of Matrices andNearest Correlation Matrices

Nick HighamSchool of Mathematics

The University of Manchester

highammamanacukhttpwwwmamanacuk~higham

NAG Quant Event New York Dec 7 2011

What is a Matrix Function

Itrsquos not

det(A) or trace(A)elementwise evaluation f (aij)AT matrix factor (eg A = LU)

It is

Aminus1radicA

eA

University of Manchester Nick Higham Matrix functions amp correlation matrices 2 35

What is a Matrix Function

Itrsquos not

det(A) or trace(A)elementwise evaluation f (aij)AT matrix factor (eg A = LU)

It is

Aminus1radicA

eA

University of Manchester Nick Higham Matrix functions amp correlation matrices 2 35

Cayley and Sylvester

Term ldquomatrixrdquo coined in 1850by James Joseph SylvesterFRS (1814ndash1897)

Matrix algebra developed byArthur Cayley FRS (1821ndash1895)Memoir on the Theory of Ma-trices (1858)

University of Manchester Nick Higham Matrix functions amp correlation matrices 3 35

Cayley and Sylvester on Matrix Functions

Cayley considered matrix squareroots in his 1858 memoir

Tony Crilly Arthur Cayley Mathemati-cian Laureate of the Victorian Age2006

Sylvester (1883) gave first defini-tion of f (A) for general f

Karen Hunger Parshall James JosephSylvester Jewish Mathematician in aVictorian World 2006

University of Manchester Nick Higham Matrix functions amp correlation matrices 4 35

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Matrices in Applied Mathematics

Frazer Duncan amp Collar Aerodynamics Division ofNPL aircraft flutter matrix structural analysis

Elementary Matrices amp Some Applications toDynamics and Differential Equations 1938Emphasizes importance of eA

Arthur Roderick Collar FRS(1908ndash1986) ldquoFirst book to treatmatrices as a branch of appliedmathematicsrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 6 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 2: Functions of Matrices and Nearest Correlation Matrices - NAG

What is a Matrix Function

Itrsquos not

det(A) or trace(A)elementwise evaluation f (aij)AT matrix factor (eg A = LU)

It is

Aminus1radicA

eA

University of Manchester Nick Higham Matrix functions amp correlation matrices 2 35

What is a Matrix Function

Itrsquos not

det(A) or trace(A)elementwise evaluation f (aij)AT matrix factor (eg A = LU)

It is

Aminus1radicA

eA

University of Manchester Nick Higham Matrix functions amp correlation matrices 2 35

Cayley and Sylvester

Term ldquomatrixrdquo coined in 1850by James Joseph SylvesterFRS (1814ndash1897)

Matrix algebra developed byArthur Cayley FRS (1821ndash1895)Memoir on the Theory of Ma-trices (1858)

University of Manchester Nick Higham Matrix functions amp correlation matrices 3 35

Cayley and Sylvester on Matrix Functions

Cayley considered matrix squareroots in his 1858 memoir

Tony Crilly Arthur Cayley Mathemati-cian Laureate of the Victorian Age2006

Sylvester (1883) gave first defini-tion of f (A) for general f

Karen Hunger Parshall James JosephSylvester Jewish Mathematician in aVictorian World 2006

University of Manchester Nick Higham Matrix functions amp correlation matrices 4 35

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Matrices in Applied Mathematics

Frazer Duncan amp Collar Aerodynamics Division ofNPL aircraft flutter matrix structural analysis

Elementary Matrices amp Some Applications toDynamics and Differential Equations 1938Emphasizes importance of eA

Arthur Roderick Collar FRS(1908ndash1986) ldquoFirst book to treatmatrices as a branch of appliedmathematicsrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 6 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 3: Functions of Matrices and Nearest Correlation Matrices - NAG

What is a Matrix Function

Itrsquos not

det(A) or trace(A)elementwise evaluation f (aij)AT matrix factor (eg A = LU)

It is

Aminus1radicA

eA

University of Manchester Nick Higham Matrix functions amp correlation matrices 2 35

Cayley and Sylvester

Term ldquomatrixrdquo coined in 1850by James Joseph SylvesterFRS (1814ndash1897)

Matrix algebra developed byArthur Cayley FRS (1821ndash1895)Memoir on the Theory of Ma-trices (1858)

University of Manchester Nick Higham Matrix functions amp correlation matrices 3 35

Cayley and Sylvester on Matrix Functions

Cayley considered matrix squareroots in his 1858 memoir

Tony Crilly Arthur Cayley Mathemati-cian Laureate of the Victorian Age2006

Sylvester (1883) gave first defini-tion of f (A) for general f

Karen Hunger Parshall James JosephSylvester Jewish Mathematician in aVictorian World 2006

University of Manchester Nick Higham Matrix functions amp correlation matrices 4 35

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Matrices in Applied Mathematics

Frazer Duncan amp Collar Aerodynamics Division ofNPL aircraft flutter matrix structural analysis

Elementary Matrices amp Some Applications toDynamics and Differential Equations 1938Emphasizes importance of eA

Arthur Roderick Collar FRS(1908ndash1986) ldquoFirst book to treatmatrices as a branch of appliedmathematicsrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 6 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 4: Functions of Matrices and Nearest Correlation Matrices - NAG

Cayley and Sylvester

Term ldquomatrixrdquo coined in 1850by James Joseph SylvesterFRS (1814ndash1897)

Matrix algebra developed byArthur Cayley FRS (1821ndash1895)Memoir on the Theory of Ma-trices (1858)

University of Manchester Nick Higham Matrix functions amp correlation matrices 3 35

Cayley and Sylvester on Matrix Functions

Cayley considered matrix squareroots in his 1858 memoir

Tony Crilly Arthur Cayley Mathemati-cian Laureate of the Victorian Age2006

Sylvester (1883) gave first defini-tion of f (A) for general f

Karen Hunger Parshall James JosephSylvester Jewish Mathematician in aVictorian World 2006

University of Manchester Nick Higham Matrix functions amp correlation matrices 4 35

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Matrices in Applied Mathematics

Frazer Duncan amp Collar Aerodynamics Division ofNPL aircraft flutter matrix structural analysis

Elementary Matrices amp Some Applications toDynamics and Differential Equations 1938Emphasizes importance of eA

Arthur Roderick Collar FRS(1908ndash1986) ldquoFirst book to treatmatrices as a branch of appliedmathematicsrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 6 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 5: Functions of Matrices and Nearest Correlation Matrices - NAG

Cayley and Sylvester on Matrix Functions

Cayley considered matrix squareroots in his 1858 memoir

Tony Crilly Arthur Cayley Mathemati-cian Laureate of the Victorian Age2006

Sylvester (1883) gave first defini-tion of f (A) for general f

Karen Hunger Parshall James JosephSylvester Jewish Mathematician in aVictorian World 2006

University of Manchester Nick Higham Matrix functions amp correlation matrices 4 35

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Matrices in Applied Mathematics

Frazer Duncan amp Collar Aerodynamics Division ofNPL aircraft flutter matrix structural analysis

Elementary Matrices amp Some Applications toDynamics and Differential Equations 1938Emphasizes importance of eA

Arthur Roderick Collar FRS(1908ndash1986) ldquoFirst book to treatmatrices as a branch of appliedmathematicsrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 6 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 6: Functions of Matrices and Nearest Correlation Matrices - NAG

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Matrices in Applied Mathematics

Frazer Duncan amp Collar Aerodynamics Division ofNPL aircraft flutter matrix structural analysis

Elementary Matrices amp Some Applications toDynamics and Differential Equations 1938Emphasizes importance of eA

Arthur Roderick Collar FRS(1908ndash1986) ldquoFirst book to treatmatrices as a branch of appliedmathematicsrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 6 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 7: Functions of Matrices and Nearest Correlation Matrices - NAG

Two Definitions

Definition (Taylor series)

If f has a Taylor series expansion f (z) =suminfin

k=0 akzk withradius of convergence r and ρ(A) lt r then

f (A) =infinsum

k=0

akAk

Definition (Cauchy integral formula)

f (A) =1

2πi

intΓ

f (z)(zI minus A)minus1 dz

where f analytic on and inside closed contour Γ enclosingλ(A)

University of Manchester Nick Higham Matrix functions amp correlation matrices 5 35

Matrices in Applied Mathematics

Frazer Duncan amp Collar Aerodynamics Division ofNPL aircraft flutter matrix structural analysis

Elementary Matrices amp Some Applications toDynamics and Differential Equations 1938Emphasizes importance of eA

Arthur Roderick Collar FRS(1908ndash1986) ldquoFirst book to treatmatrices as a branch of appliedmathematicsrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 6 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 8: Functions of Matrices and Nearest Correlation Matrices - NAG

Matrices in Applied Mathematics

Frazer Duncan amp Collar Aerodynamics Division ofNPL aircraft flutter matrix structural analysis

Elementary Matrices amp Some Applications toDynamics and Differential Equations 1938Emphasizes importance of eA

Arthur Roderick Collar FRS(1908ndash1986) ldquoFirst book to treatmatrices as a branch of appliedmathematicsrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 6 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 9: Functions of Matrices and Nearest Correlation Matrices - NAG

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 10: Functions of Matrices and Nearest Correlation Matrices - NAG

Matrix Roots in Markov Models

Let vectors v2011 v2010 represent credit ratings or stockprices in 2011 and 2010Assume a Markov model v2011 = Pv2010 where P is atransition probability matrixP12 enables predictions to be made at 6-monthlyintervals

P12 is matrix X such that X 2 = PWhat is P23 What is P09

Ps = exp(s log(P))

University of Manchester Nick Higham Matrix functions amp correlation matrices 8 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 11: Functions of Matrices and Nearest Correlation Matrices - NAG

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 12: Functions of Matrices and Nearest Correlation Matrices - NAG

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 13: Functions of Matrices and Nearest Correlation Matrices - NAG

Solving Ordinary Differential Equations

A isin Cntimesn dydt

= Ay y(0) = y0 rArr y(t) = eAty0

d2ydt2 + Ay = 0 y(0) = y0 y prime(0) = y prime0

has solution

y(t) = cos(radic

At)y0 +(radic

A)minus1 sin(

radicAt)y prime0

But also [y prime

y

]= exp

([0 minustA

t In 0

])[y prime0y0

]

University of Manchester Nick Higham Matrix functions amp correlation matrices 9 35

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 14: Functions of Matrices and Nearest Correlation Matrices - NAG

Phi Functions Definition

ϕ0(z) = ez ϕ1(z) =ez minus 1

z ϕ2(z) =

ez minus 1minus zz2

ϕk+1(z) =ϕk(z)minus 1k

z

ϕk(z) =infinsum

j=0

z j

(j + k)

University of Manchester Nick Higham Matrix functions amp correlation matrices 10 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 15: Functions of Matrices and Nearest Correlation Matrices - NAG

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 16: Functions of Matrices and Nearest Correlation Matrices - NAG

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 17: Functions of Matrices and Nearest Correlation Matrices - NAG

Phi Functions Solving ODEs

y isin Cn A isin Cntimesn

dydt

= Ay y(0) = y0 rArr y(t) = eAty0

dydt

= Ay + b y(0) = 0 rArr y(t) = t ϕ1(tA)b

dydt

= Ay + ct y(0) = 0 rArr y(t) = t2ϕ2(tA)c

University of Manchester Nick Higham Matrix functions amp correlation matrices 11 35

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 18: Functions of Matrices and Nearest Correlation Matrices - NAG

Exponential Integrators

Considery prime = Ly + N(y)

N(y(t)) asymp N(y(0)) implies

y(t) asymp etLy0 + tϕ1(tL)N(y(0))

Exponential Euler method

yn+1 = ehLyn + hϕ1(hL)N(yn)

Lawson (1967) recent resurgence

University of Manchester Nick Higham Matrix functions amp correlation matrices 12 35

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 19: Functions of Matrices and Nearest Correlation Matrices - NAG

Toolbox of Matrix Functions

Want software for evaluating interesting f at matrix argsas well as scalar argsMATLAB has expm logm sqrtm funmThe Matrix Function Toolbox (H 2008)NAG Library

f01ecf (f01ecc) for matrix exponentialf01efff01fff for function ofsymmetricHermitian matrixMore on the way

University of Manchester Nick Higham Matrix functions amp correlation matrices 13 35

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 20: Functions of Matrices and Nearest Correlation Matrices - NAG

Scaling and Squaring Method

Scale B larr A2s so Binfin asymp 1Approximate rm(B) = [mm] Padeacute approximant to eB

Square X = rm(B)2s asymp eA

Moler amp Van Loan (1978) ldquoNineteen dubious ways tocompute the exponential of a matrixrdquomdashmethodology forchoosing s and mH (2005) sharper analysis giving optimal s and mAl-Mohy amp H (2009) further improvements

Newer problem action of matrix exponential on a vector

University of Manchester Nick Higham Matrix functions amp correlation matrices 14 35

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 21: Functions of Matrices and Nearest Correlation Matrices - NAG

Compute eAb

Exploit for integer s

eAb = (esminus1A)sb = esminus1Aesminus1A middot middot middot esminus1A︸ ︷︷ ︸s times

b

Choose s so Tm(sminus1A) =summ

j=0(sminus1A)j

jasymp esminus1A Then

bi+1 = Tm(sminus1A)bi i = 0 s minus 1 b0 = b

yields bs asymp eAb

Al-Mohy amp H (2011) SIAM J Sci Comp

University of Manchester Nick Higham Matrix functions amp correlation matrices 15 35

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 22: Functions of Matrices and Nearest Correlation Matrices - NAG

ExperimentCompute etAb for HarwellndashBoeing matrices

orani678 n = 2529 t = 100 b = [11 1]T bcspwr10 n = 5300 t = 10 b = [10 01]T

2D Laplacian matrix poisson tol = 6times 10minus8

Alg AH ode15stime cost error time cost error

orani678 013 878 4e-8 136 7780+ middot middot middot 2e-6bcspwr10 0021 215 7e-7 292 1890+ middot middot middot 5e-5poisson 376 29255 2e-6 248 402+ middot middot middot 8e-6

4poisson 15 116849 9e-6 324 49+ middot middot middot 1e-1

University of Manchester Nick Higham Matrix functions amp correlation matrices 16 35

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 23: Functions of Matrices and Nearest Correlation Matrices - NAG

General Functions

SchurndashParlett algorithm (Davies amp H 2003)computes f (A) given the ability to evaluate f (k)(x) forany k and x Implemented in MATLABrsquos funmBeware unstable diagonalization algorithmfunction F = funm_ev(Afun)FUNM_EV Evaluate general matrix function via eigensystem[VD] = eig(A)F = V diag(feval(fundiag(D))) V

University of Manchester Nick Higham Matrix functions amp correlation matrices 17 35

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 24: Functions of Matrices and Nearest Correlation Matrices - NAG

Chronic Disease Example

Estimated 6-month transition matrixFour AIDS-free states and 1 AIDS state2077 observations (Charitos et al 2008)

P =

08149 00738 00586 00407 0012005622 01752 01314 01169 0014303606 01860 01521 02198 0081501676 00636 01444 04652 01592

0 0 0 0 1

Want to estimate the 1-month transition matrix

Λ(P) = 1096440498001493minus00043

H amp Lin (2011)Lin (2011 Chap 3 for survey of regularizationmethods

University of Manchester Nick Higham Matrix functions amp correlation matrices 18 35

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 25: Functions of Matrices and Nearest Correlation Matrices - NAG

MATLAB Arbitrary Powers

gtgt A = [1 1e-8 0 1]A =10000e+000 10000e-008

0 10000e+000

gtgt A^01ans =

1 00 1

gtgt expm(01logm(A))ans =

10000e+000 10000e-0090 10000e+000

University of Manchester Nick Higham Matrix functions amp correlation matrices 19 35

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 26: Functions of Matrices and Nearest Correlation Matrices - NAG

MATLAB Arbitrary Power

New Schur algorithm (H amp Lin 2011) reliablycomputes Ap for any real pNew backward-error based inverse scaling andsquaring alg for matrix logarithm (Al-Mohy and H2011) mdashfaster and more accurateAlternative Newton-based algorithms available for A1q

with q an integer eg for

Xk+1 =1q[(q + 1)Xk minus X q+1

k A] X0 = A

Xk rarr Aminus1q

University of Manchester Nick Higham Matrix functions amp correlation matrices 20 35

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 27: Functions of Matrices and Nearest Correlation Matrices - NAG

Knowledge Transfer Partnership 1

University of Manchester and NAG (2010ndash2013)funded by EPSRC NAG and TSBKTP Associate Edvin DeadmanDeveloping suite of NAG Library codes for matrixfunctions (NAG Library already has several eg for eA)At least six new codes to appear in next release ofNAG LibraryImprovements to existing state of the art faster andmore accurateSuggestions for prioritizing code developmentwelcome

My work also supported by curren2M ERC Advanced Grant

University of Manchester Nick Higham Matrix functions amp correlation matrices 21 35

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 28: Functions of Matrices and Nearest Correlation Matrices - NAG

Some NAG Toolbox Timings

All eirsquovals amp eirsquovectors of real symmetric matrixf08fc divide and conquer eig QR

n f08fc eig500 0062 0072

1000 0294 05092000 1907 3915

Matrix logarithm using the SchurndashParlett alg

n f01ej logm10 34e-4 10e-2

100 025 256500 291 9011000 212 501

University of Manchester Nick Higham Matrix functions amp correlation matrices 22 35

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 29: Functions of Matrices and Nearest Correlation Matrices - NAG

Knowledge Transfer Partnership 2

University of Manchester and NAG (2012ndash2013)funded by NAG and TSBLead academic Jack Dongarra (UT Knoxville OakRidge National Laboratory amp U Manchester)Developing tuning and integrating key components ofthe Parallel Linear Algebra for Scalable MulticoreArchitectures (PLASMA) library to support NAGproducts

University of Manchester Nick Higham Matrix functions amp correlation matrices 23 35

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 30: Functions of Matrices and Nearest Correlation Matrices - NAG

Questions From Finance Practitioners

ldquoGiven a real symmetric matrix A which is almost acorrelation matrix what is the best approximating(in Frobenius norm) correlation matrixrdquo

ldquoI am researching ways to make our companyrsquoscorrelation matrix positive semi-definiterdquo

ldquoCurrently I am trying to implement some realoptions multivariate models in a simulationframework Therefore I estimate correlationmatrices from inconsistent data set whicheventually are non psdrdquo

University of Manchester Nick Higham Matrix functions amp correlation matrices 24 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 31: Functions of Matrices and Nearest Correlation Matrices - NAG

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 32: Functions of Matrices and Nearest Correlation Matrices - NAG

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 33: Functions of Matrices and Nearest Correlation Matrices - NAG

Correlation Matrix

An n times n symmetric positive semidefinite matrix A withaii equiv 1

Properties

symmetric1s on the diagonaloff-diagonal elements between minus1 and 1eigenvalues nonnegative

Is this a correlation matrix1 1 01 1 10 1 1

Spectrum minus04142 10000 24142

University of Manchester Nick Higham Matrix functions amp correlation matrices 26 35

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 34: Functions of Matrices and Nearest Correlation Matrices - NAG

How to Proceed

times Make ad hoc modifications to matrix eg shiftnegative ersquovals up to zero then diagonally scale

radicPlug the gaps in the missing data then compute anexact correlation matrix

radicCompute the nearest correlation matrix in theweighted Frobenius norm (A2 =

sumij wiwja2

ij )Given approx correlation matrix A find correlationmatrix C to minimize Aminus C

Constraint set is a closed convex set so uniqueminimizer

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 35: Functions of Matrices and Nearest Correlation Matrices - NAG

Alternating Projections

von Neumann (1933) for subspaces

S1

S2

Dykstra (1983) incorporated corrections for closed convexsets

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 36: Functions of Matrices and Nearest Correlation Matrices - NAG

Newton Method

Qi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 37: Functions of Matrices and Nearest Correlation Matrices - NAG

Newton MethodQi amp Sun (2006) convergent Newton method basedon theory of strongly semismooth matrix functionsGlobally and quadratically convergentAlgorithmic improvements by Borsdorf amp H (2010)Implemented in NAG codes g02aaf (g02aac) andg02abf (weights lower bound on eirsquovalsmdashMark 23)

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 38: Functions of Matrices and Nearest Correlation Matrices - NAG

Factor Model (1)

ξ = X︸︷︷︸ntimesk

η︸︷︷︸ktimes1

+ F︸︷︷︸ntimesn

ε︸︷︷︸ntimes1

ηi εi isin N(01)

where F = diag(fii) Implies

ksumj=1

x2ij le 1 i = 1 n

ldquoMultifactor normal copula modelrdquoCollateralized debt obligations (CDOs)Multivariate time series

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 39: Functions of Matrices and Nearest Correlation Matrices - NAG

Factor Model (2)

Yields correlation matrix of form

C(X ) = D + XX T = D +ksum

j=1

xjxTj

D = diag(I minus XX T ) X = [x1 xk ]

C(X ) has k factor correlation matrix structure

C(X ) =

1 yT

1 y2 yT1 yn

yT1 y2 1

yT

nminus1yn

yT1 yn yT

nminus1yn 1

yi isin Rk

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 40: Functions of Matrices and Nearest Correlation Matrices - NAG

k Factor Problem

minXisinRntimesk

f (X ) = Aminus C(X )2F subject to

ksumj=1

x2ij le 1

Nonlinear objective function with convex quadraticconstraintsSome existing algs ignore the constraints

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 41: Functions of Matrices and Nearest Correlation Matrices - NAG

Algorithms

Algorithm based on spectral projected gradientmethod (Borsdorf H amp Raydan 2011)

Respects the constraints exploits their convexityand converges to a feasible stationary pointNAG routine g02aef (Mark 23)

Principal factors method (Andersen et al 2003) hasno convergence theory and can converge to anincorrect answer

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 42: Functions of Matrices and Nearest Correlation Matrices - NAG

Conclusions

Matrix functions a powerful and versatile tool withexcellent algs availableBeware unstableimpractical algs in literatureWorking with NAG to implement state of the art f (A)algs for NAG Library

Excellent algs available in NAG Library for nearestcorrelation matrix problems Further improvementscomingBeware algs in literature that may not converge orconverge to wrong solution

Keen to hear about your matrix problems

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 43: Functions of Matrices and Nearest Correlation Matrices - NAG

References I

A H Al-Mohy and N J HighamA new scaling and squaring algorithm for the matrixexponentialSIAM J Matrix Anal Appl 31(3)970ndash989 2009

A H Al-Mohy and N J HighamComputing the action of the matrix exponential with anapplication to exponential integratorsSIAM J Sci Comput 33(2)488ndash511 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 27 35

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 44: Functions of Matrices and Nearest Correlation Matrices - NAG

References II

A H Al-Mohy and N J HighamImproved inverse scaling and squaring algorithms forthe matrix logarithmMIMS EPrint 201183 Manchester Institute forMathematical Sciences The University of ManchesterUK Oct 201118 pp

L Anderson J Sidenius and S BasuAll your hedges in one basketRisk pages 67ndash72 Nov 2003|wwwrisknet|

University of Manchester Nick Higham Matrix functions amp correlation matrices 28 35

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 45: Functions of Matrices and Nearest Correlation Matrices - NAG

References III

R Borsdorf and N J HighamA preconditioned Newton algorithm for the nearestcorrelation matrixIMA J Numer Anal 30(1)94ndash107 2010

R Borsdorf N J Higham and M RaydanComputing a nearest correlation matrix with factorstructureSIAM J Matrix Anal Appl 31(5)2603ndash2622 2010

T Charitos P R de Waal and L C van der GaagComputing short-interval transition matrices of adiscrete-time Markov chain from partially observeddataStatistics in Medicine 27905ndash921 2008

University of Manchester Nick Higham Matrix functions amp correlation matrices 29 35

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 46: Functions of Matrices and Nearest Correlation Matrices - NAG

References IV

T CrillyArthur Cayley Mathematician Laureate of the VictorianAgeJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8011-4xxi+610 pp

P I Davies and N J HighamA SchurndashParlett algorithm for computing matrixfunctionsSIAM J Matrix Anal Appl 25(2)464ndash485 2003

University of Manchester Nick Higham Matrix functions amp correlation matrices 30 35

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 47: Functions of Matrices and Nearest Correlation Matrices - NAG

References V

R A Frazer W J Duncan and A R CollarElementary Matrices and Some Applications toDynamics and Differential EquationsCambridge University Press Cambridge UK 1938xviii+416 pp1963 printing

P Glasserman and S SuchintabandidCorrelation expansions for CDO pricingJournal of Banking amp Finance 311375ndash1398 2007

N J HighamThe Matrix Function Toolboxhttpwwwmamanacuk~highammftoolbox

University of Manchester Nick Higham Matrix functions amp correlation matrices 31 35

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 48: Functions of Matrices and Nearest Correlation Matrices - NAG

References VI

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM J Matrix Anal Appl 26(4)1179ndash1193 2005

N J HighamFunctions of Matrices Theory and ComputationSociety for Industrial and Applied MathematicsPhiladelphia PA USA 2008ISBN 978-0-898716-46-7xx+425 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 32 35

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 49: Functions of Matrices and Nearest Correlation Matrices - NAG

References VII

N J HighamThe scaling and squaring method for the matrixexponential revisitedSIAM Rev 51(4)747ndash764 2009

N J Higham and A H Al-MohyComputing matrix functionsActa Numerica 19159ndash208 2010

N J Higham and L LinOn pth roots of stochastic matricesLinear Algebra Appl 435(3)448ndash463 2011

University of Manchester Nick Higham Matrix functions amp correlation matrices 33 35

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 50: Functions of Matrices and Nearest Correlation Matrices - NAG

References VIII

J D LawsonGeneralized Runge-Kutta processes for stable systemswith large Lipschitz constantsSIAM J Numer Anal 4(3)372ndash380 Sept 1967

L LinRoots of Stochastic Matrices and Fractional MatrixPowersPhD thesis The University of Manchester ManchesterUK 2010117 ppMIMS EPrint 20119 Manchester Institute forMathematical Sciences

University of Manchester Nick Higham Matrix functions amp correlation matrices 34 35

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35

Page 51: Functions of Matrices and Nearest Correlation Matrices - NAG

References IX

K H ParshallJames Joseph Sylvester Jewish Mathematician in aVictorian WorldJohns Hopkins University Press Baltimore MD USA2006ISBN 0-8018-8291-5xiii+461 pp

University of Manchester Nick Higham Matrix functions amp correlation matrices 35 35