8
$\begingroup$

In R, when trying to compare non linear models with AIC, you can use the function AIC on an nls object, which is the least squares estimates of the parameters of a model obtained using the function nls. However, in the documentation of the function AIC, you can read :

"The theory of AIC requires that the log-likelihood has been maximized: whereas AIC can be computed for models not fitted by maximum likelihood, their AIC values should not be compared."

If I'm right, an nls object is not a model fitted by maximum likelihood but by least squares method. In consequence, the obtained values of AIC can not be compared. Why is that ? Should I manually calculate AIC in order to compare models fitted with nls? Is AIC appropriate for comparing non linear models?

$\endgroup$
4
$\begingroup$

Yes, AIC (or AICc) are still "generally appropriate". We make the assumption of a Gaussian error (see below).

Avoid computing AIC manually if both models are of the same type, that said: Comparing across model types requires attention to detail to make sure that parameters are counted using similar rules, and that additive constants are consistently included or not. (from: https://stat.ethz.ch/pipermail/r-help/2010-August/250839.html)

For more information type stats:::logLik.nls to see for how the log-likelihood is calculated for nls fitted models as a function of their residuals and their associated weights. (Effectively it is just a Gaussian log-likelihood of the weighted residuals.)

$\endgroup$
1
  • 3
    $\begingroup$ One additional point: Both models being compared need to have been fit with the same weighting method. $\endgroup$ Oct 20 '20 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.