[R] nls() singular graident matrix error
Dieter Menne
dieter.menne at menne-biomed.de
Sun Jul 14 10:26:03 CEST 2002
Richard,
Trying to duplicate the model in R using nls(), I took the following steps:
Foo <- deriv( ~ tph1 * ((1 - exp(-(a1*N^a2)*age2))/ (1 -
exp(-(a1*N^a2)*age)))^(-(b1*N + b2*T +
b3*F*T)), c("a1","a2","b1","b2","b3"), function(tph1, age2, age,
T, N, a1, a2, b1, b2, b3) {})
I had a similar problem, and tracked it down to a known bug in deriv, which
does not correctly handle unary minus signs. To check is this is the
problem,
rewrite
exp(-(a1*N^a2)*age2))
as
exp((-1)*(a1*N^a2)*age2))
(for all similar cases)
Even if this does not help (there might be other errors around), check
the resulting derivatives if they are correct. I never use derive unchecked,
but only to generate an expression and paste that expression into my
program.
Dieter
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list