is.PSD: Check whether covariance or correlation matrix is positive...

Description Usage Arguments Details Value Examples

Description

A covariance matrix should be positive semi-definite or else a variance can be negative. See, for example: https://epublications.bond.edu.au/cgi/viewcontent.cgi?article=1078&context=ejsie https://stats.stackexchange.com/questions/69114/why-does-correlation-matrix-need-to-be-positive-semi-definite-and-what-does-it-m https://stats.stackexchange.com/questions/125412/is-every-correlation-matrix-positive-semi-definite https://blogs.sas.com/content/iml/2012/09/12/when-is-a-correlation-matrix-not-a-correlation-matrix.html

Usage

1
is.PSD(cmat)

Arguments

cmat

A correlation or covariance matrix for asset class returns.

Details

A good discussion of the problem and possible solutions is at:

https://nickhigham.wordpress.com/2013/02/13/the-nearest-correlation-matrix/

His method is used in makePDcorr.

Value

TRUE if matrix is positive semi-definite, FALSE if not.

Examples

1
2
3
4
5
6
7
8
is.PSD(covmat(stalebrink$cormat, stalebrink$ersd$sd)) # this IS positive semi-definite
is.PSD(stalebrink$cormat)

is.PSD(covmat(rvk$cormat, rvk$ersd$sd)) # NOT PSD
is.PSD(rvk$cormat)

is.PSD(covmat(horizon10year2017$cormat, horizon10year2017$ersd$sd)) # IS PSD
is.PSD(horizon10year2017$cormat)

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