On Apr 11, 2012, at 16:51 , John C Nash wrote: > 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.
That's one view, John, but the more common one is that it is the gradient matrix of the fitted values with respect to the parameters that is singular. I.e., we are locally approximating the nonlinear relation y=f(theta0+delta) with the linear one y-f(theta0)= (Df)delta, in which Df can be singular in the usual matrix sense. That said, I completely agree that it is silly to let this condition be a show-stopper when it happens early in the iteration sequence. As long as you can move in _any_ direction and improve the sum of squares, why not go there and retry? > 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-requ...@r-project.org wrote: >> Message: 83 >> Date: Tue, 10 Apr 2012 13:03:58 -0700 (PDT) >> From: nerak13 <karen.vandep...@gmail.com> >> To: r-help@r-project.org >> Subject: [R] nls function >> Message-ID: <1334088238773-4546791.p...@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. >> > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.