[R] nearest correlation to polychoric

"Jens Oehlschlägel" oehl_list at gmx.de
Fri Jul 13 14:25:54 CEST 2007


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) 
> version
               _                           
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
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)

--



More information about the R-help mailing list