you could also have a look at function posdefify() from package
`sfsmisc'.
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: ""Jens Oehlschl?gel"" <oehl_list at gmx.de>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, July 13, 2007 2:25 PM
Subject: [R] nearest correlation to polychoric
Dear all,
Has someone implemented in R (or any other language)
Knol DL, ten Berge JMF. Least-squares approximation of an improper
correlation matrix by a proper one. Psychometrika, 1989, 54, 53-61.
or any other similar algorithm?
Best regards
Jens Oehlschl?gel
Background:
I want to factanal() matrices of polychoric correlations which have
negative eigenvalue. I coded
Highham 2002 Computing the nearest correlation matrix - a problem from
finance, IMA Journal of Numerical Analysis (2002), 22, 329-343.
which basically works but still leaves very small negative eigenvalues
which causes factanal() to fail with
factanal(cov=ncor$cor, factors=2)
Fehler in optim(start, FAfn, FAgr, method = "L-BFGS-B", lower = lower,
:
L-BFGS-B ben?tigt endliche Werte von 'fn'
Zus?tzlich: Warning message:
NaNs wurden erzeugt in: log(x)