Re: [R] Numerical stability of eigenvalue and hessian matrix in R

2015-02-18 Thread Spencer Graves
> On Feb 18, 2015, at 2:15 PM, Spencer Graves > wrote: > > >> On Feb 18, 2015, at 1:54 PM, David Winsemius > > wrote: >> >> >> On Feb 18, 2015, at 1:13 PM, C W wrote: >> >>> Thanks Thierry for the pointer, that's explains the problem. >>> >>> Is there anythin

Re: [R] Numerical stability of eigenvalue and hessian matrix in R

2015-02-18 Thread Spencer Graves
> On Feb 18, 2015, at 1:54 PM, David Winsemius wrote: > > > On Feb 18, 2015, at 1:13 PM, C W wrote: > >> Thanks Thierry for the pointer, that's explains the problem. >> >> Is there anything I can do about the matrix instability or numerical >> inaccuracy? > > There are matrix methods in the

Re: [R] Numerical stability of eigenvalue and hessian matrix in R

2015-02-18 Thread David Winsemius
On Feb 18, 2015, at 1:13 PM, C W wrote: > Thanks Thierry for the pointer, that's explains the problem. > > Is there anything I can do about the matrix instability or numerical > inaccuracy? There are matrix methods in the Rmpfr package that support increased precision, but it is implemented wi

Re: [R] Numerical stability of eigenvalue and hessian matrix in R

2015-02-18 Thread Jeff Newmiller
This question is getting pretty deep into numerical analysis theory. The usual approach has already been mentioned... don't expect high accuracy in all problems. Your specific problem could have a special technique somewhere, but don't be surprised if we are not experts in your specific problem

Re: [R] Numerical stability of eigenvalue and hessian matrix in R

2015-02-18 Thread C W
Thanks Thierry for the pointer, that's explains the problem. Is there anything I can do about the matrix instability or numerical inaccuracy? Mike On Wed, Feb 18, 2015 at 11:57 AM, Thierry Onkelinx wrote: > Have a look at FAQ 7.31 > > ir. Thierry Onkelinx > Instituut voor natuur- en bosonderzo

Re: [R] Numerical stability of eigenvalue and hessian matrix in R

2015-02-18 Thread Thierry Onkelinx
Have a look at FAQ 7.31 ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done ma

Re: [R] Numerical stability of eigenvalue and hessian matrix in R

2015-02-18 Thread C W
Hi Ben and JS, Thanks for the reply. I tried using: hessian(func = h_x, x, method = "complex"), it gives zero, that's good. # R code > hess.h <- hessian(func = h_x, x, method = "complex") > mat <- h_x(x)*hess.h - grad(h_x, x) %o% grad(h_x, x) > mat [,1][,2] [,3][,4] [1,]

Re: [R] Numerical stability of eigenvalue and hessian matrix in R

2015-02-18 Thread JS Huang
Hi, Since all entries in your hessian matrix and grad vector are integers, I suggest you execute the following for mat assignment. > mat <- round(h_x(x),digits=0)*round(hess.h,digits=0) - round(grad(h_x, > x),digits=0) %o% round(grad(h_x, x),digits=0) > mat [,1] [,2] [,3]

Re: [R] Numerical stability of eigenvalue and hessian matrix in R

2015-02-18 Thread Ben Bolker
C W gmail.com> writes: > > Hi list, > > I am running the following R code, the answer should be zero. But R gives > a very small negative number, what should I do? > > ##R code > library(numDeriv) h_x <- function(x){ a = x[1] b = x[2] c = x[3] d = x[4] (a^2 + c^2 + d^2) * (

[R] Numerical stability of eigenvalue and hessian matrix in R

2015-02-17 Thread C W
Hi list, I am running the following R code, the answer should be zero. But R gives a very small negative number, what should I do? ##R code library(numDeriv) h_x <- function(x){ a = x[1] b = x[2] c = x[3] d = x[4] (a^2 + c^2 + d^2) * (b^2 + c^2 + d^2) } x1 = 10 x2 = 1 x3 = 0 x4