[R] problem with nls starting values

Benedikt Gehr benedikt.gehr at ieu.uzh.ch
Thu Sep 27 21:15:25 CEST 2012


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.

Thanks for the help

Benedikt

Am 27.09.2012 20:00, schrieb Bert Gunter:
> My guess:
>
> You probably are overfitting your data. A straight line does about as
> well as anything except for the 3 high leverage points, which the
> minimization is probably having trouble with.
>
> -- Bert
>
>
>
> On Thu, Sep 27, 2012 at 10:43 AM, Benedikt Gehr
> <benedikt.gehr at ieu.uzh.ch> wrote:
>> quantiles<-c(seq(.05,.95,0.05))
>> slopes<-c( 0.000000e+00,  1.622074e-04 , 3.103918e-03 , 2.169135e-03 ,
>> 9.585523e-04
>> ,1.412327e-03 , 4.288103e-05, -1.351171e-04 , 2.885810e-04 ,-4.574773e-04
>> , -2.368968e-03, -3.104634e-03, -5.833970e-03, -6.011945e-03, -7.737697e-03
>> , -8.203058e-03, -7.809603e-03, -6.623985e-03, -9.414477e-03)
>> plot(slopes~quantiles)
>
>

-- 
Benedikt Gehr
Ph.D. Student

Institute of Evolutionary Biology and Environmental Studies
University of Zurich
Winterthurerstrasse 190
CH-8057 Zurich

Office 13 J 36b
Phone: +41 (0)44 635 49 72
http://www.ieu.uzh.ch/staff/phd/gehr.html




More information about the R-help mailing list