[R] Find A, given B where B=A'A
Charles C. Berry
cberry at tajo.ucsd.edu
Wed Oct 31 22:33:44 CET 2007
On Thu, 1 Nov 2007, Rolf Turner wrote:
>
> 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)
Also, see
?chol
Chuck
>
> 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}}
>
> ______________________________________________
> 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