# [R] NLS "Singular Gradient" Error

Walmes Zeviani walmeszeviani at hotmail.com
Wed Apr 28 17:56:27 CEST 2010

```I don't know any about you research but I agree with Gabor: the model is
identifiable.

No*(1-exp(a*(b*Ne-T))) can be reparametrized to No*(1-exp(C*NeD)), where
C=a*b and D=a*T. This reduces the model to 3 parameters and can see shown
that is a reperametrization of the SSasympOff() defined in R (with default
start values). "No" is a parameter too, so you need provide start values in
start list. Look:

# indentifiability
No <- 100; a <- 1; b <- -1; T <- 2
Ne <- seq(1, 10, l=8)

curve(No*(1-exp(a*(b*x-T))), 0, 10)
abline(h=No*(1-exp(a*(b*0-T)))) # intercept

C <- a*b; D <- a*T

help(SSasympOff, help_type="html")

# model speficication
nls(Ne~No*(1-exp(a*(b*Ne-T))), start=list(a=1.2, b=0.015, T=24))
^                 ^
^                 ^
y                 y?

> y <- No*(1-exp(a*(b*Ne-T)))+rnorm(Ne,0,0.1)
> plot(y~Ne)
> nls(y~No*(1-exp(a*(b*Ne-T))), start=list(No=No, a=a, b=b, T=T))
Erro em numericDeriv(form[[3L]], names(ind), env) :
Obtido valor faltante ou infinito quando avaliando o modelo
> nls(y~No*(1-exp(C*Ne-D)), start=list(No=No, C=C, D=D))
Nonlinear regression model
model:  y ~ No * (1 - exp(C * Ne - D))
data:  parent.frame()
No       C       D
99.9763 -0.9972  2.0197
residual sum-of-squares: 0.02746

Number of iterations to convergence: 2
Achieved convergence tolerance: 6.673e-07
>

Bests.

-----
..ooo0
...................................................................................................
..(....)... 0ooo...                              Walmes Zeviani
...\..(.....(.....)...     Master in Statistics and Agricultural
Experimentation
....\_)..... )../....       walmeszeviani at hotmail.com, Lavras - MG, Brasil
............
(_/............................................................................................
--
View this message in context: http://r.789695.n4.nabble.com/NLS-Singular-Gradient-Error-tp2069029p2073452.html
Sent from the R help mailing list archive at Nabble.com.

```