On 27-09-2012, at 21:15, Benedikt Gehr <benedikt.g...@ieu.uzh.ch> wrote:
> thanks for your reply > > I agree that an lm model would fit just as well, however the expectation from > a mechanistic point of view would be a non-linear relationship. > > Also when I "simulate" data as in > > y_val<-115-118*exp(-0.12*(seq(1,100)+rnorm(100,0,0.8))) > x_val<-seq(1:100) > plot(y_val~x_val) > summary(mod1<-nls(y_val~a-b*exp(-c*x_val),start=list(a=115,b=118,c=0.12))) > > I do not get a convergence. I obviously must be doing something wrong. I do get convergence: > nls(y_val~a-b*exp(-c*x_val),start=list(a=115,b=118,c=0.12)) Nonlinear regression model model: y_val ~ a - b * exp(-c * x_val) data: parent.frame() a b c 115.0420 117.0529 0.1192 residual sum-of-squares: 181.6 Number of iterations to convergence: 3 Achieved convergence tolerance: 1.436e-07 > sessionInfo() R version 2.15.1 Patched (2012-09-11 r60679) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base Berend ______________________________________________ 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.