[R] problem with nls starting values
Benedikt Gehr
benedikt.gehr at ieu.uzh.ch
Thu Sep 27 19:43:57 CEST 2012
Hi
I would like to fit a non-linear regression to the follwoing data:
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)
I want to fit two models: asymptotic decay and logistic decay(s-shaped).
I tried self-starting functions (SSlogis and SSasymp) like this:
dframe<-data.frame(cbind(slopes,quantiles))
names(dframe)<-c("slopes","quantiles")
summary(mod1<-nls(slopes ~ SSlogis( quantiles, Asym, xmid,
scal),data=dframe))
summary(mod1<-nls(slopes ~ SSasymp( quantiles, Asym, resp0,
lrc),data=dframe))
and I tried to specify the starting values myself. But I usually don't
even get the nls started. It's always some singular gradient error or
some other related error message (stopped after 50 iterations,etc.).
When I leave out some values from the middle quantiles I manage to fit a
3-parameter logistic model, but if I use all the values it doesn't work
any longer.
Then I simulated perfect asymptotic decay data and tried to to fit an
nls() with the correct parameter values, but it won't work either. What
am I doing wrong?
Any help would be most appreciated
Best
benedikt
--
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