Recall that nls assumes normal, independent errors. Thus, the
likelihood is
prod( (1/(sigma*sqrt(2*pi))*exp(-0.5*(resid[i]/sigma)^2)).
Therefore, the log(likelihood) is
(-0.5)*( N*log(2*pi*sigma^2) + sum(resid[i]^2)/sigma^2).
You can somehow get the MLE of "sigma", plug this into this
formula, and get the log(likelihood). The AIC is
(-2)*(log(likelihood)+k), where k = number of parameters estimated,
including sigma.
I don't know the simplest way to get this, and I don't have time
to play with it, but ?nls contains a pointer to ?nls.object. The latter
says it has a component "residuals". From this, you can compute "sigma"
= sum(residuals^2)/N, where N = total number of observations. NOTE:
You want to use the MLE here, not (N-k) for the unbiased estimate.
There is probably a much easier way to get this, but I can't think
of it right now.
hope this helps.
spencer graves
Tropmedres wrote:
Hello
I am doing the curve fitting using the non-linear regression (nls). I am not
sure how to select the best model when I cannot get the AIC as in usual lm,
glm, gam model. I cannot use the stepAIC function from the MASS library
neither. For the nested models I have been using 'anova.nls with test=chisq'
but what about the non-nested models?
Thank you in advance
Wirichada
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|