makePDcorr: Get the nearest positive definite correlation matrix to the...

Description Usage Arguments Details Value Examples

Description

Note that this insists upon returning a positive definite correlation matrix. We would be satisfied if it only returned a positive semi-definite matrix, but that does not seem to be an option.

Usage

1
makePDcorr(cormat)

Arguments

cormat

A correlation matrix for asset class returns.

Details

See: Higham, Nicholas J. (2002) Computing the Nearest Correlation Matrix—A Problem from Finance. IMA Journal of Numerical Analysis, 22 (3). pp. 329-343. ISSN 0272-4979 http://eprints.ma.man.ac.uk/232/

Value

cormat if correlation matrix is positive definite, FALSE if not.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library("magrittr")

is.PSD(rvk$cormat)
cormat2 <- makePDcorr(rvk$cormat)
is.PSD(cormat2)

# compare:
rvk$cormat %>% round(., 2)
cormat2 %>% round(., 2)
(cormat2 - rvk$cormat) %>% round(., 2)

donboyd5/portopt documentation built on May 20, 2019, 2:58 p.m.