[R] how do I make a correlation matrix positive definite?

Ravi Varadhan rvaradhan at jhmi.edu
Fri Oct 22 15:56:40 CEST 2010


Nick Higham (2002) discusses algorithms for this.  One of the algorithms
discussed in the paper is implemented in the "Matrix" package as `nearPD'
function.

library(Matrix)
?nearPD

Ravi.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of beyza doganay
Sent: Friday, October 22, 2010 6:14 AM
To: r-help at r-project.org
Subject: [R] how do I make a correlation matrix positive definite?

Hi,

If a matrix is not positive definite, make.positive.definite() function in
corpcor library finds the nearest positive definite matrix by the method
proposed by Higham (1988).

However, when I deal with correlation matrices whose diagonals have to be 1
by definition, how do I do it? The above-mentioned function seem to mess up
the diagonal entries. [I haven't seen this complication, but obviously all
entries must remain in (-1,1) range after conversion.]

Any R tools to handle this?

I'd appreciate any help.


-- 
Beyza Doganay

	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list