Displaying 20 results from an estimated 1100 matches similar to: "Cholesky Decomposition in R"
2005 Jan 21
1
Cholesky Decomposition
Can we do Cholesky Decompositon in R for any matrix
---------------------------------
[[alternative HTML version deleted]]
2012 Feb 21
1
System is computationally singular error when using cholesky decompostion in MCMC
Hello Everyone
I have a MCMC loop to calculate a time varying hierarchical Bayesian
structure.
This requires me to use around 5-6 matrix inversions in the loop.
I use cholesky and chol2inv for the matrix decomposition.
Because of the data I am working with I am required to invert a 167 by 167
matrix twice in one iteration.
I need to run the iteration for 10000 times, but I get the error
2009 Mar 27
3
about the Choleski factorization
Hi there,
Given a positive definite symmetric matrix, I can use chol(x) to obtain U where U is upper triangular
and x=U'U. For example,
x=matrix(c(5,1,2,1,3,1,2,1,4),3,3)
U=chol(x)
U
# [,1] [,2] [,3]
#[1,] 2.236068 0.4472136 0.8944272
#[2,] 0.000000 1.6733201 0.3585686
#[3,] 0.000000 0.0000000 1.7525492
t(U)%*%U # this is exactly x
Does anyone know how to obtain L such
2011 Dec 29
1
Cholesky update/downdate
Dear R-devel members,
I am looking for a fast Cholesky update/downdate. The matrix A being
symmetric positive definite (n, n) and factorized as
A = L %*% t(L), the goal is to factor the new matrix A +- C %*% t(C)
where C is (n, r). For instance, C is 1-column when adding/removing an
observation in a linear regression. Of special interest is the case
where A is sparse.
Looking at the
2009 Apr 01
2
Need Advice on Matrix Not Positive Semi-Definite with cholesky decomposition
Dear fellow R Users:
I am doing a Cholesky decomposition on a correlation matrix and get error message
the matrix is not semi-definite.
Does anyone know:
1- a work around to this issue?
2- Is there any approach to try and figure out what vector might be co-linear with another in thr Matrix?
3- any way to perturb the data to work around this?
Thanks for any suggestions.
2007 Apr 24
1
Matrix: how to re-use the symbolic Cholesky factorization?
I have been playing around with sparse matrices in the Matrix
package, in particularly with the Cholesky factorization of matrices
of class dsCMatrix. And BTW, what a fantastic package.
My problem is that I have to carry out repeated Cholesky
factorization of a spares symmetric matrices, say Q_1, Q_2, ...,Q_n,
where the Q's have the same non-zero pattern. I know in this case one
does
2006 Mar 15
1
Log Cholesky parametrization in lme
Dear R-Users
I used the nlme library to fit a linear mixed model (lme). The random effect standard errors and correlation reported are based on a Log-Cholesky parametrization. Can anyone tell me how to get the Covariance matrix of the random effects, given the above mentioned parameters based on the Log-Cholesky parametrization??
Thanks in advance
Pryseley
2006 May 12
2
reusing routines
I've created some Splus code for a microarray problem that
- needed to be in C, to take advantage of some sparse matrix
properties
- uses a cholesky decompostion as part of the computation
For the cholesky, I used the cholesky2 routine, which is a part of the
survival library. It does just what I want and I'm familiar with it (after
all, I wrote it).
In Splus, this all works
2011 Oct 23
1
A problem with chol() function
I think I am missing something with the chol() function. Here is my calculation:
?
> mat
???? [,1] [,2] [,3] [,4] [,5]
[1,]??? 1??? 3??? 0??? 0??? 0
[2,]??? 0??? 1??? 0??? 0??? 0
[3,]??? 0??? 0??? 1??? 0??? 0
[4,]??? 0??? 0??? 0??? 1??? 0
[5,]??? 0??? 0??? 0??? 0??? 1
> eigen(mat)
$values
[1] 1 1 1 1 1
$vectors
???? [,1]????????? [,2] [,3] [,4] [,5]
[1,]??? 1 -1.000000e+00??? 0??? 0??? 0
2007 Jul 02
2
how to use mle with a defined function
Hi all,
I am trying to use mle() to find a self-defined function. Here is my
function:
test <- function(a=0.1, b=0.1, c=0.001, e=0.2){
# omega is the known covariance matrix, Y is the response vector, X is the
explanatory matrix
odet = unlist(determinant(omega))[1]
# do cholesky decomposition
C = chol(omega)
# transform data
U = t(C)%*%Y
WW=t(C)%*%X
beta = lm(U~W)$coef
Z=Y-X%*%beta
2000 Mar 21
2
chol2inv question
Hi there,
Please help me this out.
> m
[,1] [,2]
[1,] 1.1 1.0
[2,] 1.0 1.1
> chol2inv(m)
[,1] [,2]
[1,] 1.5094597 -0.7513148
[2,] -0.7513148 0.8264463
>
CT
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or
2009 Nov 25
1
R: Re: R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails
Dear Peter,
thank you very much for your answer.
My problem is that I need to calculate the following quantity:
solve(chol(A)%*%Y)
Y is a 3*3 diagonal matrix and A is a 3*3 matrix. Unfortunately one
eigenvalue of A is negative. I can anyway take the square root of A but when I
multiply it by Y, the imaginary part of the square root of A is dropped, and I
do not get the right answer.
I tried
2012 Aug 11
3
Problem when creating matrix of values based on covariance matrix
Hi,
I want to simulate a data set with similar covariance structure as my
observed data, and have calculated a covariance matrix (dimensions
8368*8368). So far I've tried two approaches to simulating data:
rmvnorm from the mvtnorm package, and by using the Cholesky
decomposition (http://www.cerebralmastication.com/2010/09/cholesk-post-on-correlated-random-normal-generation/).
The problem is
2004 Nov 18
1
Method dispatch S3/S4 through optimize()
I have been running into difficulties with dispatching on an S4 class
defined in the SparseM package, when the method calls are inside a
function passed as the f= argument to optimize() in functions in the spdep
package. The S4 methods are typically defined as:
setMethod("det","matrix.csr", function(x, ...) det(chol(x))^2)
that is within setMethod() rather than by name before
2002 Jun 05
1
as.generic
I've been writing some matrix-type methods for a new class of sparse matrices
and for most methods this has been straightforward. However, there are
examples, like %*% and chol, that (apparently) R doesn't automatically
recognize as generic. What to do in these cases? At this point, I've
been writing new generic methods with slightly perturbed names %m% and
cholesky for example in
2012 Jul 31
1
about changing order of Choleski factorization and inverse operation of a matrix
Dear All,
My question is simple but I need someone to help me out.
Suppose I have a positive definite matrix A.
The funtion chol() gives matrix L, such that A = L'L.
The inverse of A, say A.inv, is also positive definite and can be
factorized as A.inv = M'M.
Then
A = inverse of (A.inv) = inverse of (M'M) = (inverse of M) %*%
(inverse of M)'
= ((inverse of
2001 Mar 13
1
.C-calls
Dear all,
(sorry I got the wrong button for subscribing a minute ago)
At the moment I'm writing on a package for random field
simulation that I'd like to make publically availabe
in near future.
To this end I've asked Martin Maechler to have a look
at my R-code. He was very surprised about how
I perform the ".C"-calls, and encouraged me to
make this request for comments.
2012 Apr 25
1
trouble installing SparseM
Dear R People:
I am attempting to install SparseM on R 2.15.0 on a Linux 11.10 system.
Here is the output
> install.packages("SparseM",depen=TRUE)
Installing package(s) into ?/home/erin/R/x86_64-pc-linux-gnu-library/2.15?
(as ?lib? is unspecified)
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL
2004 Feb 28
2
matrix inverse in C
Hi,
I'm writing an R package using the C code i've written. I'm wondering if
anyone knows an easy way to calculate an inverse and cholesky factor of a
matrix using the Fortran/C library of R: and how to call them from C. My
code is based on the Numerical Reciepe code, and I'm trying to use
something that is already in R.
Thanks for your help in advance,
Kosuke
2012 May 03
0
Modified Cholesky decomposition for sparse matrices
I am trying to estimate a covariance matrix from the Hessian of a posterior mode. However, this Hessian is indefinite (possibly because of numerical/roundoff issues), and thus, the Cholesky decomposition does not exist. So, I want to use a modified Cholesky algorithm to estimate a Cholesky of a pseudovariance that is reasonably close to the original matrix. I know that there are R packages that