Description Usage Arguments Details Value Examples
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
1 | is.PSD(cmat)
|
cmat |
A correlation or covariance matrix for asset class returns. |
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.
TRUE if matrix is positive semi-definite, FALSE if not.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.