Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-18 Thread Ravi Varadhan
- Original Message - From: avraham.ad...@guycarp.com Date: Thursday, June 18, 2009 10:54 am Subject: RE: [R] Matrix inversion-different answers from LAPACK and LINPACK To: Ravi Varadhan Cc: r-help@r-project.org > Thank you. One question, though. In the case where I have closed form > f

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-18 Thread Avraham . Adler
Subject RE: [R] Matrix inversion-different

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Ravi Varadhan
-help-boun...@r-project.org] On Behalf Of avraham.ad...@guycarp.com Sent: Wednesday, June 17, 2009 6:11 PM To: Douglas Bates Cc: dmba...@gmail.com; r-help@r-project.org Subject: Re: [R] Matrix inversion-different answers from LAPACK and LINPACK I will be the first one to admit I may be doing s

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Ravi Varadhan
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of avraham.ad...@guycarp.com Sent: Wednesday, June 17, 2009 6:11 PM To: Douglas Bates Cc: dmba...@gmail.com; r-help@r-project.org Subject: Re: [R] Matrix

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Avraham . Adler
am.ad...@guycarp.com, r-help@r-project.org 06/17/2009 05:55 Subject PM Re: [R] Matrix inversion-different answers fro

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Douglas Bates
On Wed, Jun 17, 2009 at 2:02 PM, Albyn Jones wrote: > As you seem to be aware, the matrix is poorly conditioned: > >> kappa(PLLH,exact=TRUE) > [1] 115868900869 > > It might be worth your while to think about reparametrizing. Also, if it is to be a variance-covariance matrix then it must be positiv

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Albyn Jones
As you seem to be aware, the matrix is poorly conditioned: > kappa(PLLH,exact=TRUE) [1] 115868900869 It might be worth your while to think about reparametrizing. albyn On Wed, Jun 17, 2009 at 11:37:48AM -0400, avraham.ad...@guycarp.com wrote: > > Hello. > > I am trying to invert a matrix, and

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Avraham . Adler
Subject RE: [R] Matrix inversion-different answers from LAPACK a

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Ravi Varadhan
PM cc Subject RE: [R] Matrix inversion-different

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Avraham . Adler
cc Subject RE: [R] Matrix inversion-different

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Ravi Varadhan
Avraham, You can make LAPACK work by doing the following: Hinv[, 1] <- solve(qr(PLLH, LAPACK=TRUE), c(1,0)) Hinv[, 2] <- solve(qr(PLLH, LAPACK=TRUE), c(0,1)) Here is an example: H <- matrix(runif(4), 2, 2) H <- H + t(H) Hinv <- solve(qr(H)) # this is the correct inverse from LINPACK Hinv1 <-

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-17 Thread Ravi Varadhan
Hi Avraham, I think this is a bug in solve() and qr.solve(). The structure of the QR object produced by LINPACK and LAPACK are different. In fact, the help page for qr says: "qr a matrix with the same dimensions as x. The upper triangle contains the R of the decomposition and the lower triang

Re: [R] matrix inversion using solve() and matrices containing large/small values

2008-03-05 Thread Douglas Bates
On Wed, Mar 5, 2008 at 7:43 AM, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > On 3/5/2008 8:21 AM, gerardus vanneste wrote: > > Hello > > > > I've stumbled upon a problem for inversion of a matrix with large values, > > and I haven't found a solution yet... Someone with experience in numerical l

Re: [R] matrix inversion using solve() and matrices containing large/small values

2008-03-05 Thread Charilaos Skiadas
Sorry, I meant to send this to the whole list. On Mar 5, 2008, at 8:46 AM, Charilaos Skiadas wrote: > The problem doesn't necessarily have to do with the range of data. > At first level, it has to do with the simple fact that dfdb has > rank 6 at most, (7 at most in general, though in your ca

Re: [R] matrix inversion using solve() and matrices containing large/small values

2008-03-05 Thread Duncan Murdoch
On 3/5/2008 8:21 AM, gerardus vanneste wrote: > Hello > > I've stumbled upon a problem for inversion of a matrix with large values, > and I haven't found a solution yet... I wondered if someone could give a > hand. (It is about automatic optimisation of a calibration process, which > involves the

Re: [R] Matrix inversion

2008-02-18 Thread Bill.Venables
Ben Domingue asks: > I am trying to invert a matrix for the purposes of least squares. I > have tried a number of things, and the variety of results has me > confused. Don't be. > 1. When I try solve() I get the following: > >Error in solve.default(t(X) %*% X) : system is computationally > sing

Re: [R] Matrix Inversion

2007-12-12 Thread Peter Dalgaard
Wang Chengbin wrote: > I got the following error: > > a = read.csv("mat.csv") > b = as.matrix(a) > tb = t(b) > bb = tb %*% b > dim(bb) > ibb = solve(bb) > bb %*% ibb > > >> ibb = solve(bb) >> > Error in solve.default(bb) : > system is computationally singular: reciprocal condition number

Re: [R] Matrix Inversion

2007-12-12 Thread Robin Hankin
Hello Wang matrix bb is symmetric positive semidefinite, so algebraically the eigenvalues are nonnegative. I would use bb <- crossprod(b) to calculate bb (faster and possibly more accurate) Look at eigen(bb,TRUE,TRUE)$values (see ?eigen for the meaning of the arguments) to see how many very s