I have a covariance matrix, S
, which I use Cholesky decomposition to find A
. It is stated that AA'=S
, however, I am not recovering S
when I do AA'
. The example code in R is as follows.
S <- matrix(c(1.091385, 1.949606, 1.949606, 4.520746), 2, 2)
A <- chol(S)
T <- t(A)
R <- A %*% T
As can be seen, S
is as follows.
1.091385, 1.949606 1.949606, 4.520746
But R
is as follows.
4.574082, 1.901370 1.901370, 1.038049
And for completeness, A
is as follows.
1.044694, 1.866199 0.000000, 1.018847
However, when I do A'A
with the code R <- T %*% A
, I do recover S
.
Any ideas on what I'm doing wrong? Or is the link on Wikipedia wrong? The R examples on Cholesky decomposition seems to suggest A'A=S
.
crossprod(A)
returns. $\endgroup$crossprod(A)
returnsS
(the expected answer). So, insofar as the link on Wikipedia, should I useA
orA'
as returned bychol
? $\endgroup$crossprod
is doing. $\endgroup$U
in the call of the routinedpstrf
that actually compute the Cholesky.) $\endgroup$