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