Re: [R] Error singular gradient matrix at initial parameter estimates in nls

2011-06-30 Thread Peter Ehlers
On 2011-06-30 06:14, Niklaus Hurlimann wrote: Greetings, I am struggling a bit with a non-linear regression. The problem is described below with the known values r and D inidcated. I tried to alter the start values but get always following error message: Error in nlsModel(formula, mf, start,

Re: [R] Error singular gradient matrix at initial parameter estimates in nls

2011-06-30 Thread Walmes Zeviani
I think that these aren't good initial values. If you do a plot of data and add a curve, the curve don't approximate the data. Frequently I use interactive procedures to get good initial values. Using playwith() you can handle sliders to adjust values and use in nls(), look the following r -

[R] Error singular gradient matrix at initial parameter estimates in nls

2011-06-30 Thread Niklaus Hurlimann
Greetings, I am struggling a bit with a non-linear regression. The problem is described below with the known values r and D inidcated. I tried to alter the start values but get always following error message: Error in nlsModel(formula, mf, start, wts): singular gradient matrix at initial

[R] Error singular gradient matrix at initial parameter estimates in nls

2010-03-31 Thread Prof. John C Nash
If you have a perfect fit, you have zero residuals. But in the nls manual page we have: Warning: *Do not use ‘nls’ on artificial zero-residual data.* So this is a case of complaining that your diesel car is broken because you ignored the Diesel fuel only sign on the filler cap and put

Re: [R] Error singular gradient matrix at initial parameter estimates in nls

2010-03-31 Thread Corrado
Dear JN, Bert, 1) It is not a perfect fit. I do not think I have ever said that. I said that an external algorithms fits the model without any problems: with ~ 500,000 data points and 19 paramters (ki in the original equation), it fits the model in less than 1 second. The data are not

Re: [R] Error singular gradient matrix at initial parameter estimates in nls

2010-03-31 Thread Ravi Varadhan
-project.org Subject: Re: [R] Error singular gradient matrix at initial parameter estimates in nls Dear JN, Bert, 1) It is not a perfect fit. I do not think I have ever said that. I said that an external algorithms fits the model without any problems: with ~ 500,000 data points and 19 paramters

Re: [R] Error singular gradient matrix at initial parameter estimates in nls

2010-03-31 Thread Bert Gunter
-project.org Subject: Re: [R] Error singular gradient matrix at initial parameter estimates in nls Dear JN, Bert, 1) It is not a perfect fit. I do not think I have ever said that. I said that an external algorithms fits the model without any problems: with ~ 500,000 data points and 19 paramters (ki

[R] Error singular gradient matrix at initial parameter estimates in nls

2010-03-30 Thread Corrado
I am using nls to fit a non linear function to some data. The non linear function is: y= 1- exp(-(k0+k1*p1+ + kn*pn)) I have chosen algorithm port, with lower boundary is 0 for all of the ki parameters, and I have tried many start values for the parameters ki (including generating them

Re: [R] Error singular gradient matrix at initial parameter estimates in nls

2010-03-30 Thread Gabor Grothendieck
You could try method=brute-force in the nls2 package to find starting values. On Tue, Mar 30, 2010 at 7:03 AM, Corrado ct...@york.ac.uk wrote: I am using nls to fit a non linear function to some data. The non linear function is: y= 1- exp(-(k0+k1*p1+ + kn*pn)) I have chosen algorithm

Re: [R] Error singular gradient matrix at initial parameter

2010-03-30 Thread Corrado
Hi Gabor, same problem even using nls2 with method=brute-force to calculate the initial parameters. Best, Gabor Grothendieck wrote: You could try method=brute-force in the nls2 package to find starting values. On Tue, Mar 30, 2010 at 7:03 AM, Corrado ct...@york.ac.uk wrote: I am using

Re: [R] Error singular gradient matrix at initial parameter

2010-03-30 Thread Gabor Grothendieck
Sorry, its algorithm=brute-force On Tue, Mar 30, 2010 at 10:29 AM, Corrado ct...@york.ac.uk wrote: Hi Gabor, same problem even using nls2 with method=brute-force to calculate the initial parameters. Best, Gabor Grothendieck wrote: You could try method=brute-force in the nls2 package to

Re: [R] Error singular gradient matrix at initial parameter

2010-03-30 Thread Corrado
Yes, of course. The problem still stays. Gabor Grothendieck wrote: Sorry, its algorithm=brute-force On Tue, Mar 30, 2010 at 10:29 AM, Corrado ct...@york.ac.uk wrote: Hi Gabor, same problem even using nls2 with method=brute-force to calculate the initial parameters. Best, Gabor

Re: [R] Error singular gradient matrix at initial parameter

2010-03-30 Thread Gabor Grothendieck
What do you mean the problem still stays? If you are using brute force its not a problem to have it fail on some of the evaluations since each one is separate. How large a grid are you using? Are you claiming that every single point on the grid fails? Please provide reproducible code showing