[R] Find A, given B where B=A'A
Rolf Turner
r.turner at auckland.ac.nz
Wed Oct 31 22:22:57 CET 2007
On 1/11/2007, at 9:13 AM, Michael Gormley wrote:
> Given a matrix B, where B=A'A, how can I find A?
> In other words, if I have a matrix B which I know is another matrix
> A times
> its transpose, can I find matrix A?
You can't, because A is not unique. You can easily find ***a***
solution.
E.g. A1 <- matrix(1:4,ncol=2)
B <- t(A1)%*%A1
A2 <- msqrt(B)
A2 != A1 (A2 is symmetric), yet t(A2)%*%A2 == B.
The function msqrt() above is a simple-minded calculation of the
square root of a positive semi-definite real matrix, the code of
which I just cribbed from an old posting by Prof. Brian Ripley:
msqrt <- function(X) {
e <- eigen(X)
V <- e$vectors
V%*%diag(sqrt(e$values))%*%t(V)
}
The problem of finding ***all possible*** solutions A to A'A = B
(for B symmetric positive semi-definite) is likely to be hard,
but may have been solved by the linear algebraists. I dunno.
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
More information about the R-help
mailing list