Perhaps to clarify Prof. Ripley's remarks below , the part that you missed
was "symmetric," which your matrix obviously is not.

-- Bert

2011/10/23 Prof Brian Ripley <rip...@stats.ox.ac.uk>

> On Sun, 23 Oct 2011, Ron Michael wrote:
>
>  I think I am missing something with the chol() function. Here is my
>> calculation:
>>
>>
>>> mat
>>>
>>      [,1] [,2] [,3] [,4] [,5]
>> [1,]    1    3    0    0    0
>> [2,]    0    1    0    0    0
>> [3,]    0    0    1    0    0
>> [4,]    0    0    0    1    0
>> [5,]    0    0    0    0    1
>>
>>> eigen(mat)
>>>
>> $values
>> [1] 1 1 1 1 1
>> $vectors
>>      [,1]          [,2] [,3] [,4] [,5]
>> [1,]    1 -1.000000e+00    0    0    0
>> [2,]    0  7.401487e-17    0    0    0
>> [3,]    0  0.000000e+00    1    0    0
>> [4,]    0  0.000000e+00    0    1    0
>> [5,]    0  0.000000e+00    0    0    1
>>
>>> chol(mat)
>>>
>> Error in chol.default(mat) :
>>   the leading minor of order 2 is not positive definite
>>
>> As per the eigen values my matrix is PD (as all eigen values are
>> positive). Then why still I can not get Cholesky factor of my matrix? Can
>> somebody point mw where I am missing?   Thanks and regards,
>>
>
> Reading the help page:
>
>     Compute the Choleski factorization of a real symmetric
>                                                  ^^^^^^^^^
>     positive-definite square matrix.
>
> ....
>
>     Note that only the upper triangular part of ‘x’ is used, so that
>               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> A <- diag(5)
> A[1,2] <- A[2,1] <- 3
> eigen(A)$values
> [1]  4  1  1  1 -2
>
>
>
> --
> Brian D. Ripley,                  rip...@stats.ox.ac.uk
> Professor of Applied Statistics,  
> http://www.stats.ox.ac.uk/~**ripley/<http://www.stats.ox.ac.uk/%7Eripley/>
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> ______________________________________________
> R-help@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

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to