[R] nls function
John C Nash
nashjc at uottawa.ca
Wed Apr 11 16:51:05 CEST 2012
nls() often gives this message, which is misleading in that it is the Jacobian that is not
of full rank in the solution of J * delta ~ - residuals or in more conventional
Gauss-Newton J' * J delta = -g = - J' * residuals. My view is that the gradient itself
cannot be "singular". It's just the slope of the sum of squares w.r.t. the parameters.
I'm separately sending you an experimental code that does get an answer. It is in the
package nlmrt on R-forge
https://r-forge.r-project.org/R/?group_id=395
which is under development.
Note that the I() function doesn't seem to be defined. I left it out to get an answer.
John Nash
On 04/11/2012 06:00 AM, r-help-request at r-project.org wrote:
> Message: 83
> Date: Tue, 10 Apr 2012 13:03:58 -0700 (PDT)
> From: nerak13 <karen.vandepoel at gmail.com>
> To: r-help at r-project.org
> Subject: [R] nls function
> Message-ID: <1334088238773-4546791.post at n4.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
> Hi,
>
> I've got the following data:
>
> x<-c(1,3,5,7)
> y<-c(37.98,11.68,3.65,3.93)
> penetrationks28<-dataframe(x=x,y=y)
>
> now I need to fit a non linear function so I did:
>
> fit <- nls(y ~ I(a+b*exp(1)^(-c * x)), data = penetrationks28, start =
> list(a=0,b = 1,c=1), trace = T)
>
> The error message I get is:
> Error in nls(y ~ I(a + b * exp(1)^(-c * x)), data = penetrationks28, start =
> list(a = 0, :
> singular gradient
>
> I've tried to change the startervalues but it always gives the same error
>
> I've also tried the following adjustment hoping that the c value would be
> negative:
>
> fit <- nls(y ~ I(a+b*exp(1)^(c * x)), data = penetrationks28, start = list(a
> = 1,b = 1,c=1), trace = T)
>
> but then the error message is:
> Error in nls(y ~ I(a + b * exp(1)^(c * x)), data = penetrationks28, start =
> list(a = 1, :
> number of iterations exceeded maximum of 50
>
> What can I do ?
>
> Thanks in advance
>
> --
> View this message in context: http://r.789695.n4.nabble.com/nls-function-tp4546791p4546791.html
> Sent from the R help mailing list archive at Nabble.com.
>
More information about the R-help
mailing list