Ralf Engelhorn wrote:
Dear R helpers,

is there a function or way within R to solve A'A=S for A, where all
matrices have p x p order and S is a variance-covariance matrix?

Thank you,
Ralf Engelhorn

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

See ?chol. Here's an example:

R> S = diag(4)
R> S[row(S) < col(S)] =
+  S[row(S) > col(S)] = 0.5
R> S
     [,1] [,2] [,3] [,4]
[1,]  1.0  0.5  0.5  0.5
[2,]  0.5  1.0  0.5  0.5
[3,]  0.5  0.5  1.0  0.5
[4,]  0.5  0.5  0.5  1.0
R> A = chol(S)
R> t(A) %*% A
     [,1] [,2] [,3] [,4]
[1,]  1.0  0.5  0.5  0.5
[2,]  0.5  1.0  0.5  0.5
[3,]  0.5  0.5  1.0  0.5
[4,]  0.5  0.5  0.5  1.0
R>

Sundar

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to