[R] Problem fitting a non-linear regression model with nls

Nathalie Yauschew-Raguenes nathalie.yauschew-Raguenes at bordeaux.inra.fr
Wed Jan 13 15:02:39 CET 2010


Hi,

I'm trying to make a regression of the form :

formula <- y ~ Asym_inf  + Asym_sup * ( (1 / (1 + (n1 * (exp( (tmid1-x) 
/ scal1) )^(1/n1) ) ) ) - (1 / (1 + (n2 * (exp( (tmid2-x) / scal2) 
)^(1/n2) ) ) ) )
which is a sum of the generalized logistic model proposed by richards.

with data such as these:

x <- c(88,113,128,143,157,172,184,198,210,226,240,249,263,284,302,340)
y <- 
c(0.04,0.16,1.09,2.65,2.46,2.43,1.88,2.42,1.51,1.70,1.92,1.35,0.89,0.34,0.13,0.10) 


I use the nls function to fit my data to the model.

nls(formule, data=cbind.data.frame(x,y), start=list(Asym_inf 
=min(y),Asym_inf =max(y)-min(y), 
n1=1,n2=1,tmid1=120,tmid2=250,scal1=11,scal2=30))

and it always finished by one of those answers (even if I change the 
initial values) :
- "Error in nls(formule, data = cbind.data.frame(x, y), start = 
list(Asym_inf =min(y),  : \n  le pas 0.000488281 est devenu inférieur à  
'minFactor' de 0.000976562\n"
- "Error in nls(formule, data = cbind.data.frame(x, y), start = 
list(miny = min(y),  : \n  gradient singulier\n"
- "Error in numericDeriv(form[[3]], names(ind), env) : \n  Valeur 
manquante ou infinie obtenue au cours du calcul du modèle\n")
- "Error in nlsModel(formula, mf, start, wts) : \n  singular gradient 
matrix at initial parameter estimates\n"
So it seems that I reach a local extremum each time. I know that most 
of  the problem comes from the choice of the initial values of the 
parameters Asym_inf, Asym_inf, n1, n2, tmid1, tmid2, scal1and scal2.

My question is how could I estimate those initial values so that the nls 
fitting works.

Thanks in advance

-- 
Nathalie YAUSCHEW-RAGUENES
Ph.D Student

Unité de Recherches Ecologie Fonctionnelle et Physique de l'Environnement (EPHYSE)
INRA, Centre de Bordeaux - Aquitaine
71 Av Edouard Bourlaux
33883 Villenave d'Ornon Cedex
France



More information about the R-help mailing list