[R] Cholesky decomposition error

nataraj at orchidpharma.com nataraj at orchidpharma.com
Fri Jun 15 08:30:32 CEST 2012


Thanks for your reply. To my surprise I can find one more strange behavior of  my 15X15 matrix "A", that is if I call the function  chol(A) in the terminal it decompose the matrix fine without any errors or warnings.
But if I call the function chol() within a function, which I have written in order to call the function (contains formula) for optimization routine "optim()" and also supplied with the same matrix "A" as argument, the error mentioned

> Error in chol.default(M_cov) :
>  the leading minor of order 10 is not positive definite

is surfaced during the function call by optim.

Why the matrix fulfill the symmetric and positive definite for chol() in one case but fails in other case when the function chol() is called in other function ?

I played around parameters of "optim" function but nothing seems to be working and I am confused and I am looking for some hints to introspect the problem further.

Regards,
B.Nataraj





-----Original Message-----
From: Bert Gunter [mailto:gunter.berton at gene.com]
Sent: Thursday, June 14, 2012 6:18 PM
To: Nataraj B (ORLL-Biotech)
Cc: r-help at r-project.org
Subject: Re: [R] Cholesky decomposition error

Your matrix is not symmetric, positive definite. If you don't know
what this means, you shouldn't be using chol()

This may be because it isn't to begin with, or due to numerical error,
it doesn't behave as one in the decomposition. My relative ignorance
of numeric methods for linear algebra prevents me from saying more
than that.

-- Bert

On Thu, Jun 14, 2012 at 4:23 AM,  <nataraj at orchidpharma.com> wrote:
> Dear friends,
>
> When I do Cholesky decomposition for a 15x15 matrix using the function chol(), I get the following error for which I do not understand the meaning of the error
>
> Error in chol.default(M_cov) :
>  the leading minor of order 10 is not positive definite
>
> When I searched online for similar error reported earlier I could get few hits but not of much help to resolve my error and one post suggested to use different function called sechol() from accuracy package but that did not work and it leads to different errors. So I want to stick to function chol() itself.
>
> Could you please help me to find where things are going wrong in my matrix?
>
>
> Thanks and regards,
> B.Natarj
>
> ______________________________________________
> 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.



--

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list