[R] nearest correlation to polychoric

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Fri Jul 13 14:43:08 CEST 2007

you could also have a look at function posdefify() from package 

I hope it helps.


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/

----- 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


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)
> version
platform       i386-pc-mingw32
arch           i386
os             mingw32
system         i386, mingw32
major          2
minor          4.1
year           2006
month          12
day            18
svn rev        40228
language       R
version.string R version 2.4.1 (2006-12-18)


R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide 
and provide commented, minimal, self-contained, reproducible code.

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

More information about the R-help mailing list