Odette Gaston
2010-Sep-10 18:49 UTC
[R] Maximum log likelihood estimates of the parameters of a nonlinear model.
Dear all, Is it possible to generate AIC or something equivalent for nonlinear model estimated based on maximum log likelihood l in R? I used nls based on least squares to estimate, and therefore I cannot assess the quality of models with AIC. nlme seems good for only mixed models and mine is not mixed models. res <- nls(y ~ d*(x)^3+a*(x)^2+b*x+c, start=list(a=2, b=1,c=1,d=1), data=d) If anybody does know a R-function to estimate nonlinear model based on maximum log likelihood, please let me know. Thanks for your help in advance! Odette
Ben Bolker
2010-Sep-10 19:25 UTC
[R] Maximum log likelihood estimates of the parameters of a nonlinear model.
Odette Gaston <odette.gaston <at> gmail.com> writes:> > Dear all, > > Is it possible to generate AIC or something equivalent for nonlinear > model estimated based on maximum log likelihood l in R? > I used nls based on least squares to estimate, and therefore I cannot > assess the quality of models with AIC. nlme seems good for only mixed > models and mine is not mixed models. > > res <- nls(y ~ d*(x)^3+a*(x)^2+b*x+c, start=list(a=2, b=1,c=1,d=1), data=d) > > If anybody does know a R-function to estimate nonlinear model based on > maximum log likelihood, please let me know. >AIC(res) should work just fine. Ordinary least-squares fitting is equivalent to assuming that the residuals are independent and normally distributed with a homogeneous variance. If you're willing to make those assumptions you're set. If not, there are various options for relaxing them: gnls in the nlme package for correlation and heteroscedasticity, mle (stats4) or mle2 (bbmle) for normality.