I'm seeing some "inconsistencies" on how R calculates the Akaike Information Criterion (AIC) for linear regression models. I'd like to get its expression so I can calculate it myself. The issues I'm referring to can be seen here:

complex_model <- lm(mpg~hp+wt, mtcars)
simple_model <- lm(mpg~hp, mtcars)

The difference in AIC between both models stay the same, however the values don't. I understand that for all practical effect in model selection this doesn't change much, but why is the results different? What expressions are these values obtained from?


1 Answer 1


See this answer:

What is the difference between AIC() and extractAIC() in R?

I discovered this by inspecting the code of the step() function, looking at the help for extractAIC() and, finding that confusing, searching CrossValidated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.