[R] B %*% t(B) = R , then solve for B
Doran, Harold
HDoran at air.org
Wed Apr 13 19:22:41 CEST 2011
Correct. In the example I gave you yesterday, I used a different matrix, but showed this solution because it also answered the other question you had about doing it on non-square matrices. Of course, Spencer Graves also gave a very useful answer suggesting QR decomposition.
I also gave you the example in the context of linear regression because that is commonly why statisticians will use these factorizations.
If your matrix is small, chol() works fine. If your matrix is big and sparse, see Cholesky() in the matrix package (a package that I often refer to as a God-send)
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
> Behalf Of Shawn Koppenhoefer
> Sent: Tuesday, April 12, 2011 12:33 PM
> To: r-help at r-project.org
> Subject: Re: [R] B %*% t(B) = R , then solve for B
> Importance: High
>
> Solution found...
>
> Sorry for not having known this,...
>
> Apparently, what I was after is called a "Choleski factorization".
>
>
> The solution pops right out of R, as follows:
>
> > M<-matrix(c(0.6098601, 0.2557882, 0.1857773,
> + 0.2557882, 0.5127065, -0.1384238,
> + 0.1857773, -0.1384238, 0.9351089 ),
> + nrow=3, ncol=3, byrow=TRUE)
> > chol(M)
> [,1] [,2] [,3]
> [1,] 0.7809354 0.3275408 0.2378907
> [2,] 0.0000000 0.6367288 -0.3397722
> [3,] 0.0000000 0.0000000 0.8735398
> >
>
>
>
> Thanks again for all your help!
>
>
> /shawn
>
> ______________________________________________
> 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.
More information about the R-help
mailing list