Re: [R] Cholesky Decomposition in R

2009-03-11 Thread Manli Yan
Thank you guys so much Regards~ 2009/3/11 Simon Wood > > A <- matrix(runif(25),5,5); A <- A%*%t(A) ## Example +ve def matrix > > U <- chol(A) ## start from factor given by chol > D <- diag(U) ## extract sqrt(D) > L <- t(U/D) ## get unit lower triangular factor > D <- diag(D^2) #

Re: [R] Cholesky Decomposition in R

2009-03-11 Thread Simon Wood
A <- matrix(runif(25),5,5); A <- A%*%t(A) ## Example +ve def matrix U <- chol(A) ## start from factor given by chol D <- diag(U) ## extract sqrt(D) L <- t(U/D) ## get unit lower triangular factor D <- diag(D^2) ## and diagonal ## So now A = LDL' range(A-L%*%D%*%t(L)) #best, #Simon

Re: [R] Cholesky Decomposition in R

2009-03-11 Thread Ravi Varadhan
ple/Faculty/Varadhan.html -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Douglas Bates Sent: Tuesday, March 10, 2009 10:14 PM To: Manli Yan Cc: r-help@r-project.org Subject: Re: [R] Cholesky Decomposition i

Re: [R] Cholesky Decomposition in R

2009-03-10 Thread megh
A=matrix(c(1,1,1,1,5,5,1,5,14),nrow=3) t(eigen(A)$vector) %*% A %*% eigen(A)$vector mat1 = t(eigen(A)$vector) mat2 = diag(eigen(A)$values)# this is your diagonal matrix Manli Yan wrote: > > Hi everyone: > I try to use r to do the Cholesky Decomposition,which is A=LDL',so far I > only f

Re: [R] Cholesky Decomposition in R

2009-03-10 Thread Douglas Bates
On Tue, Mar 10, 2009 at 4:33 PM, Manli Yan wrote: >  Hi everyone: >  I try to use r to do the Cholesky Decomposition,which is A=LDL',so far I > only found how to decomposite A in to  LL' by using chol(A),the function > Cholesky(A) doesnt work,any one know other command to decomposte A in to > LDL'

Re: [R] Cholesky Decomposition in R

2009-03-10 Thread Albyn Jones
try Cholesky() in package Matrix. albyn On Tue, Mar 10, 2009 at 02:33:01PM -0700, Manli Yan wrote: > Hi everyone: > I try to use r to do the Cholesky Decomposition,which is A=LDL',so far I > only found how to decomposite A in to LL' by using chol(A),the function > Cholesky(A) doesnt work,any

Re: [R] Cholesky Decomposition in R

2009-03-10 Thread Ravi Varadhan
ty/Varadhan.html -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Manli Yan Sent: Tuesday, March 10, 2009 5:33 PM To: r-help@r-project.org Subject: [R] Cholesky Decomposition in R Hi everyone:

[R] Cholesky Decomposition in R

2009-03-10 Thread Manli Yan
Hi everyone: I try to use r to do the Cholesky Decomposition,which is A=LDL',so far I only found how to decomposite A in to LL' by using chol(A),the function Cholesky(A) doesnt work,any one know other command to decomposte A in to LDL' My r code is: library(Matrix) A=matrix(c(1,1,1,1,5,5,1,