From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>

Date: Wed 24 Jan 2007 - 08:02:19 GMT

Date: Wed 24 Jan 2007 - 08:02:19 GMT

On Wed, 24 Jan 2007, gallon li wrote:

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

According to your subject line A is positive definite and hence symmetric? The usual definition of a matrix square root involves a transpose, e.g. B'B = A. There are many square roots: were you looking for a symmetric one?

*> e <- eigen(A)
**> V <- e$vectors
**> V %*% diag(e$values) %*% t(V)
*

recovers A (up to rounding errors), and

*> B <- V %*% diag(sqrt(e$values)) %*% t(V)
*

is such that B %*% B = A. Even that is not unique, e.g. -B is an equally good answer.

*> For example
*

(with A = b and B = a, it seems)

> 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.
**>
*

-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ 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@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 19:09:40 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 - 09: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.
*