Gottlieb, Neil
2009-Apr-01 13:56 UTC
[R] Need Advice on Matrix Not Positive Semi-Definite with cholesky decomposition
Dear fellow R Users: I am doing a Cholesky decomposition on a correlation matrix and get error message the matrix is not semi-definite. Does anyone know: 1- a work around to this issue? 2- Is there any approach to try and figure out what vector might be co-linear with another in thr Matrix? 3- any way to perturb the data to work around this? Thanks for any suggestions.
Ravi Varadhan
2009-Apr-01 14:26 UTC
[R] Need Advice on Matrix Not Positive Semi-Definite with cholesky decomposition
Look at the nearPD() function in the package "Matrix". require(Matrix) ?nearPD In particular, pay attention to the arguments "eig.tol" and "posd.tol", which you can tweak to define how much "positiveness" you would like to have. Ravi. ---------------------------------------------------------------------------- ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvaradhan at jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html ---------------------------------------------------------------------------- -------- -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Gottlieb, Neil Sent: Wednesday, April 01, 2009 9:57 AM To: 'r-help at r-project.org' Subject: [R] Need Advice on Matrix Not Positive Semi-Definite with cholesky decomposition Dear fellow R Users: I am doing a Cholesky decomposition on a correlation matrix and get error message the matrix is not semi-definite. Does anyone know: 1- a work around to this issue? 2- Is there any approach to try and figure out what vector might be co-linear with another in thr Matrix? 3- any way to perturb the data to work around this? Thanks for any suggestions. ______________________________________________ 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.
stenka1 at go.com
2009-Apr-01 14:46 UTC
[R] Need Advice on Matrix Not Positive Semi-Definite with cholesky decomposition
Neil, pls tell why do you need the correlation matrix? if you are trying to simulate correlated variables then you can go around the cholesky by using svd. if you really need the correlation ( I think it is always possible to avoid it ) then Rmetrics have a function to turn your matrix into positive semi-definite. you can also consider a factor model which will reduce the dimensionality tremendously. Stephen C. Bond On Apr 1, 2009, ngottlieb at marinercapital.com wrote: Dear fellow R Users: I am doing a Cholesky decomposition on a correlation matrix and get error message the matrix is not semi-definite. Does anyone know: 1- a work around to this issue? 2- Is there any approach to try and figure out what vector might be co-linear with another in thr Matrix? 3- any way to perturb the data to work around this? Thanks for any suggestions. ______________________________________________ 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.