[R] AIC and numbers of parameters

Philip Stephens Philip.Stephens at bristol.ac.uk
Fri Apr 21 18:57:20 CEST 2006

Hi.  I'm fairly new to R and have a quick question regarding AIC, logLik 
and numbers of parameters.  I see that there has been some correspondence 
on this in the past but none of the threads seem to have been 
satisfactorily resolved.

I have been trying to use R to obtain AIC for fitted models and then to 
extrapolate to AICc.

For example, using simple x-y regression data, I fitted a linear regression 
[lm(y~x)] and an exponential curve [nls(y~A*exp(B*x))].  AICs reported for 
these models are based on degrees of freedom of 3 and 2, respectively.  It 
seems clear to me that the number of parameters in both cases is 3 (two 
coefficients plus the error term).  Consequently, I'm dubious about the 
values of AIC provided by R.  Equally, however, I'm reluctant to base my 
own calculations on logLik and my own estimates of K, without first 
determining why R uses the degrees of freedom it does.

If anyone can explain why R gives different dfs for two models each with 
two parameters, I should be very grateful.


More information about the R-help mailing list