Re: [R] AIC using nls function

2010-08-28 Thread Ben Bolker
Bert Gunter  gene.com> writes:

> 
> John:
> 
> 1. As always, and as requested (see posting guide), a small
> reproducible example might help.

  Bert is right that things aren't well defined.  However, AIC
is still *widely* used for nonlinear models.  For the sloppy
folks among us, here are some useful (?) pieces of information:

 1. nls counts the variance of the residual error as a parameter

 2. As long as you compute AIC *within the same framework* (e.g.
comparing nls fits to each other, or glm fits, or nlme fits ...)
these decisions are generally made consistently.  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.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] AIC using nls function

2010-08-27 Thread Bert Gunter
John:

1. As always, and as requested (see posting guide), a small
reproducible example might help.

2. What is CLi in your model?

3. In general, AIC  may not be particularly meaningful as a measure of
fit quality penalized for model complexity in NON-linear models unless
the different models are "nested" in very specific ways, which are
model-centric. The reason is that while the log likelihood part of AIC
is clearly defined (at least up to the quality of the convergence),
the number of parameters is not. That is, a single parameter in the
model may count as more or less than one parameter, in some sense.
Indeed, this is what distinguishes nonlinear from linear models where,
for example, the definition of "nested" models is mathematically
unequivocal (their basis vectors define nested linear subspaces). This
is not true for nonlinear models, because the manifolds in question
are nonlinear.  A detailed understanding and explanation of exactly
what this means exceeds my understanding. Doug Bates's PhD thesis and
subsequent papers (+ others, no doubt) go into this.


Cheers,

Bert Gunter
Genentech Nonclinical Statistics


On Fri, Aug 27, 2010 at 7:45 AM, John Ludlam  wrote:
> Using the nls function I fit the following model (and some others) to my data.
> mod1=nls(CLr ~ A-(A-CLi)*exp(-k*d), start = list(A=60,k=0.005))
> I would like to rank a set of models using AIC.
>
> I calculated AIC as
> AIC(mod1)
>
> However, it appears to use an incorrect number of parameters (3
> instead of 2).  Why is this?
>
> Additionally, if I calculate AIC using the residuals sum of squares instead
> of the log likelihood, the AIC values, and resulting delta AICs differ between
> the two approaches.  What am I missing?
>
> RSS=231.5;K=2;N=30
> N*log(RSS/N)+2*K
>
> Help is appreciated,
>
> John
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.