# Calculation of AICc NonLinearModelFit

I have been using NonlinearModelFit in a current study. Outputs from this procedure include AIC and AICc.

AICc can be calculated from AIC via the following relation:

$$\text{AICc} = \text{AIC} + \frac{2k(k+1)}{n-k-1}$$

If a model with $3$ parameters is considered, then $k = 3$, and if $5$ data points are used in the fitting then $n = 5$. With these assumptions,

$$\frac{2k(k+1)}{n-k-1}=\frac{2\times 3(3+1)}{5-3-1}=24/1=24$$

The denominator of this expression would be zero for $4$ data points.

I have performed an analysis with 5 data points. The value of AICc should be AIC + 24. In this instance NonlinearModelFit calculated AICc = Infinity.

Is this an error or am I missing something?

• Estimating 3 parameters (and probably 4 parameters if one counts the error variance) with just 5 data points and expecting a good enough result (coefficient estimates and/or AIC) is...well...just plain silly.
– JimB
Commented Dec 20, 2016 at 21:58
• Jim, I know that you are indeed right. The bigger question is:
– HPM
Commented Dec 21, 2016 at 14:19
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Commented Dec 22, 2016 at 5:54

You're not counting all of the parameters as you need to include the error variance. So with $n=5$ data points and 3 coefficients and one error variance the number of parameters is $k=4$ and $n-k-1=0$, hence the resulting infinity. (Variances are parameters, too!)

See Hurvich & Tsai (1989) (Biometrika (1989), 76, 2, pp. 297-307).

Update

So for a standard regression model with just a single error term Mathematica uses the Hurvich & Tsai (1989) formula:

$$AIC_c=AIC+{{2(k+1)(k+2)}\over{n-k-2}}$$

where $k$ is the number of parameters in the model (not counting the error variance). (For a linear model $k$ is the rank of the design matrix.) This gives $\infty$ when $k=n-2$ as you found.

For whatever it's worth PROC MIXED in SAS with METHOD=ML (ML for maximum likelihood rather than REML for restricted maximum likelihood) with a single error variance uses a slightly different formula for $AIC_c$ to avoid dividing by zero when $k=n-2$:

$$AIC_c=AIC+{{2(k+1)(k+2)}\over{\max{(n,k+3)}-k-2}}$$

• Thanks Jim. You put me on the right track
– HPM
Commented Dec 21, 2016 at 15:12