[R] R: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails
simona.racioppi at libero.it
simona.racioppi at libero.it
Mon Nov 23 13:18:04 CET 2009
Thanks Chuck!
It works! But Once I have the square root of this matrix, how do I convert it
to a real (not imaginary) matrix which has the same property? Is that
possible?
Best,
Simon
>----Messaggio originale----
>Da: cberry at tajo.ucsd.edu
>Data: 21-nov-2009 18.11
>A: "simona.racioppi at libero.it"<simona.racioppi at libero.it>
>Cc: <r-help at r-project.org>
>Ogg: chol( neg.def.matrix ) WAS: Re: [R] Choleski and Choleski with pivoting
of matrix fails
>
>On Sat, 21 Nov 2009, simona.racioppi at libero.it wrote:
>
>> Hi Everyone,
>>
>> I need to take the square root of the following matrix:
>>
>> [,1] [,2] [,3]
>> [1,] 0.5401984 -0.3998675 -1.3785897
>> [2,] -0.3998675 1.0561872 0.8158639
>> [3,] -1.3785897 0.8158639 1.6073119
>>
>> I tried Choleski which fails. I then tried Choleski with pivoting, but
>> unfortunately the square root I get is not valid. I also tried eigen
>> decomposition but i did no get far.
>>
>> Any clue on how to do it?!
>
>
>If you want to take the square root of a negative definite matrix, you
>could use
>
> sqrtm( neg.def.mat )
>
>from the expm package on rforge:
>
> http://r-forge.r-project.org/projects/expm/
>
>HTH,
>
>Chuck
>
>
>>
>> Thanks,
>> Simon
>>
>> ______________________________________________
>> 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.
>>
>
>Charles C. Berry (858) 534-2098
> Dept of Family/Preventive
Medicine
>E mailto:cberry at tajo.ucsd.edu UC San Diego
>http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
>
>
>
More information about the R-help
mailing list