On Apr 10, 2012, at 4:03 PM, nerak13 wrote:

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 ?


?nls

"Warning:
Do not use nls on artificial "zero-residual" data."

Get more data. (with 3 coefficients and 4 data points you have created a zero-residual situation even if it's not "artificial".)

--
David Winsemius, MD
West Hartford, CT

______________________________________________
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.

Reply via email to