Skip to content
Prev 18259 / 398503 Next

anova() for nlm or nls

Roland Regoes <rregoes at emory.edu> writes:
For nls there is an anova.nls function that can be used to compare two
or more models.  It is in the nls package.

Because nlm is a general optimization routine it would not be possible
to write a model comparison function for two models fit by nlm.  You
would need to be more specific about what the criterion means
statistically.  For example, if the criterion is the log-likelihood
then you can compare the fitted models via a likelihood ratio test
with p-values determined from a chi-square distribution.
For nonlinear models I prefer to incorporate the constraints into the
definition of the parameters.  If a parameter such as a rate constant
can only take on positive values then I do the optimization with
respect to the logarithm of the rate constant.  In most such cases the
residual sum of squares is closer to being quadratic in the scale of
the logarithm of the rate constant than in the scale of the rate
constant.  Your mileage may vary.

If you prefer to use constraints you should try the optim function
which offers a constrained optimization method.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._