search for: chol

Displaying 20 results from an estimated 259 matches for "chol".

Did you mean: chel
2006 Feb 20
2
Matrix / SparseM conflict (PR#8618)
Full_Name: David Pleydell Version: 2.2.1 OS: Debian Etch Submission from: (NULL) (193.55.70.206) There appears to be a conflict between the chol functions from the Matrix and the SparseM packages. chol() can only be applied to a matrix of class dspMatrix if SparseM is not in the path. with gratitude David > library(Matrix) > sm <- as(as(Matrix(diag(5) + 1), "dsyMatrix"), "dspMatrix") > chol(sm) 5 x 5 Matri...
2004 Nov 18
1
Method dispatch S3/S4 through optimize()
...ies 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 the setMethod(). When called from within functions passed as the f= argument to optimize, the S3 generics for det() and chol() get picked up, not the S4 generics for the S4 SparseM classes. This looks for instance like (from example(...
2009 Jul 03
3
Variable names in lattice XY-plot
Hi, how can I get a more descriptive text instead of the variable names in my XY-lattice plot, according to the table below? Variable text acet = "Acetylaspartate Thalamus" chol = "Choline Thalamus" acetp = "Acetylaspartate parieoc" ino = "Inositole Thalamus" I could not find a solution. Please have a look at my syntax. Thanks a lot, Udo library(lattice) grp <-c(0,1,0,1) zp <- c(1,1,2,2) acet <- c(1.7,1.8,1.9,1.8) ch...
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] [...
2001 Aug 19
2
error message in chol() (PR#1061)
Full_Name: Jerome Asselin Version: 1.3.0 OS: Windows 98 Submission from: (NULL) (24.77.112.193) I am having accuracy problems involving the computation of inverse of nonnegative definite matrices with solve(). I also have to compute the Choleski decomposition of matrices. My numerical problems involving solve() made me find a bug in the chol() function. Here is an example. #Please, load the (8x8) matrix "mat" given below. #The matrix "mat" is indeed invertible as solve(mat) #exists. However, the command chol(mat) #...
2005 Oct 27
0
Column names in qr() and chol() (PR#8258)
I am using 2.2.0 If the QR decomposition of an N*M matrix is such that the pivoting order is not 1:M, Q%*%R does not result in the original matrix but in a matrix with the columns permuted. This is clearly intentional, and probably to be expected if pivoting is used --- chol() behaves in the same manner (it would perhaps be nice if the qr help page made that clear in the same way that the chol() help page does). The small bug is that column names are not permuted in the same way, so that, after permuting the columns of Q%*%R so that it is equal to the input matrix, i...
2002 Feb 20
1
Pivoting in chol
Hi Everyone, I have modified my version of R-1.4.1 to include choleski with pivoting (like in Splus). I thought R-core might consider including this in the next version of R, so I give below the steps required to facilitate this. 1. Copied Linpack routine "dchdc.f" into src/appl 2. Inserted line F77_SUBROUTINE(dchdc) in src/appl/ROUTINES 3. Inserted...
2009 Mar 10
5
Cholesky Decomposition in R
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,5,14),nrow=3) > chol(A) [,...
2007 Nov 24
1
Hmisc: can not reproduce figure 4 of Statistical Tables and Plots using S and LATEX
...n not reproduce figure 4 of *Statistical Tables and Plots using S and LATEX* by Prof. Frank Harrell with the following code: rm(list=ls()) library(Hmisc) getHdata(pbc) attach(pbc) age.groups <- cut2(age, c(45,60)) g <- function(y) apply(y, 2, quantile, c(.25,.5,.75)) y <- with(pbc, cbind(Chol=chol,Bili=bili)) # You can give new column names that are not legal S names # by enclosing them in quotes, e.g. 'Chol (mg/dl)'=chol vars <- with(pbc, c(label(chol), label(bili))) label(y) <- paste(vars, collapse=' and ') # Will make nice caption in table s3 <- summary(y ~ a...
1999 Sep 27
2
chol() dimnames
Hi Everyone, Just a minor point, but could chol() be changed to include the dimnames of the original matrix? This will ensure that x and t(R) %*% R have the same dimnames, where R <- chol(x). So we just need to insert if (!is.null(dx <- dimnames(x))) dimnames(z$v) <- dx ahead of the return. Cheers, Jonathan. Jonathan...
2010 Sep 19
1
Problem with "list"
Dear all, I have following list object: dat <- vector("list", length=4) for(i in 1:4) dat[[i]] <- diag(rnorm(5)^2) names(dat) <- paste("A", 1:4, sep="") It is ok upto this point. However if I want apply, suppose chol() function on any of it's element, I am getting error: > chol(dat['A1']) Error in chol.default(dat["A1"]) : non-numeric argument to 'chol' Can somebody point me where I am doing wrong? Thanks and regards,
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 any...
2001 Mar 13
1
.C-calls
...t;-calls, and encouraged me to make this request for comments. My calls typically look like result <- double(10000) .C("test",as.double(inputparameter),result,DUP=FALSE) return(result) In order to avoid sending C-code, I'd like to give the following example that uses `chol' of the "base"-package of R. The fact that it is a .Fortran-call instead of a .C-call shouldn't matter. ## creating a positive definite matrix of size 100x100 lc <- as.integer(100); cov.matrix <- matrix(runif(lc * lc), nrow=lc) cov.ma...
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 M)')'%*% (inverse of M)...
2005 Jul 05
1
calling fortran functions CHOL and DPOTRF form Fortran
Hi all, I'm working out some Fortran code for which I want to compute the Choleski decomposition of a covariance matrix in Fortran. I tried to do it by two methods : 1) Calling the lapack function DPOTRF. I can see the source code and check that my call is correct, but it does not compile with: system("R CMD SHLIB ~/main.f") dyn.load("~/main.so") I get:...
2009 Nov 26
0
R: RE: R: Re: R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails
...nfo about the degrees of freedom of a model... Simona >----Messaggio originale---- >Da: RVaradhan at jhmi.edu >Data: 25-nov-2009 18.55 >A: <simona.racioppi at libero.it>, <P.Dalgaard at biostat.ku.dk> >Cc: <r-help at r-project.org> >Ogg: RE: [R] R: Re: R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails > >I do not understand what the problem is, as it works just fine for me: > >A <- matrix(c(0.5401984,-0.3998675,-1.3785897,-0.3998675,1.0561872, >0.8158639,-1.3785897, 0.8158639, 1.6073119), 3, 3, by...
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 to exploit the diagonal...
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 the expectation that I'll eventually rename them when I discover the source of...
2007 Oct 02
3
mcv package gamm function Error in chol(XVX + S)
...(y~s(lon,lat,bs="tp", m=2)+offset(log(exp.)), random=list(dist=~1), family="poisson", niterPQL=30) when I run the gamm function I obtain the next error message: %%% Maximum number of PQL iterations: 30 iteration 1 iteration 2 ... iteration 8 iteration 9 iteration 10 Error in chol(XVX + S) : the leading minor of order 29 is not positive definite %%% Could be any problem in gamm() ??? -- [[alternative HTML version deleted]]
2008 Dec 01
1
gee + rcs
Hi all, I have fitted a gee model with the gee package and included restricted cubic spline functions. Here is the model: chol.g <- gee(SKIN ~ rcs(CHOLT, 3), id=ID, data=chol, family=binomial(link="logit"), corstr="exchangeable") To extract the log odds I use: predict.glm(chol.g, type = "link") Now I want to compute the logg odds for specific CHOLT values (the dependent variable) that...