- The formula for AIC = - 2 max loglikelihood + 2 k, where k is the number of estimated parameters.
- But Mathematica strangely uses (k+1) rather than just k in computing AIC
Example: data = {{51,55},{100,68},{63,60},{52,40},{67,45},{42,49},{81,62},{70,56},{108,93},{90,76}};
lm=LinearModelFit[data,x,x];
k = 2;
(* 1 for the slope parameter + 1 for the intercept parameter *)
n = Length[data];
ser=Sqrt[Total[lm["FitResiduals"]^2]/(n-k)];
(* this is the standard error of the regression *)
lm["AIC"]
-2 LogLikelihood[NormalDistribution[0,ser],lm["FitResiduals"]]+ 2 (k+1)
75.5076
75.5076
I had to add 1 to k to make the results agree. So, why does Mathematica use k + 1 rather than just k?
|
|