[R] Matrix question: obtaining the square root of a positive definite matrix?

From: gallon li <gallon.li_at_gmail.com>
Date: Wed 24 Jan 2007 - 07:04:15 GMT


I want to compute B=A^{1/2} such that B*B=A.

For example

 a=matrix(c(1,.2,.2,.2,1,.2,.2,.2,1),ncol=3)

so
> a

     [,1] [,2] [,3]
[1,] 1.0 0.2 0.2
[2,] 0.2 1.0 0.2
[3,] 0.2 0.2 1.0
> a%*%a

     [,1] [,2] [,3]
[1,] 1.08 0.44 0.44
[2,] 0.44 1.08 0.44
[3,] 0.44 0.44 1.08

> b=a%*%a

i have tried to use singular value decomposion

> c=svd(b)

> c$u%*%diag(sqrt(c$d))

           [,1] [,2] [,3]
[1,] -0.8082904 2.043868e-18 0.6531973
[2,] -0.8082904 -5.656854e-01 -0.3265986
[3,] -0.8082904 5.656854e-01 -0.3265986

this does not come close to the original a. Can anybody on this forum enlight me on how to get a which is the square root of b?

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch 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. Received on Wed Jan 24 18:09:47 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 24 Jan 2007 - 08:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.