[R] nls function

nerak13 karen.vandepoel at gmail.com
Tue Apr 10 22:03:58 CEST 2012


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