----Messaggio originale----
Da: p.dalgaard at biostat.ku.dk
Data: 21-nov-2009 18.56
A: "Charles C. Berry"<cberry at tajo.ucsd.edu>
Cc: "simona.racioppi at libero.it"<simona.racioppi at libero.it>, <r-help at r-
Ogg: Re: [R] chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with
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?!
But that matrix is not negative definite! It has 2 positive and one
negative eigenvalue. It is non-positive definite.
It is fairly easy in any case to get a matrix square root from the eigen
decomposition:
v%*%diag(sqrt(d+0i))%*%t(v)
[,1] [,2] [,3]
[1,] 0.5164499+0.4152591i -0.1247682-0.0562317i -0.7257079+0.3051868i
[2,] -0.1247682-0.0562317i 0.9618445+0.0076145i 0.3469916-0.0413264i
[3,] -0.7257079+0.3051868i 0.3469916-0.0413264i 1.0513849+0.2242912i
ch <- v%*%diag(sqrt(d+0i))%*%t(v)
t(ch)%*% ch
[,1] [,2] [,3]
[1,] 0.5401984+0i -0.3998675-0i -1.3785897-0i
[2,] -0.3998675-0i 1.0561872+0i 0.8158639-0i
[3,] -1.3785897-0i 0.8158639-0i 1.6073119-0i
A triangular square root is, er, more difficult, but hardly impossible.
--
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907