Akaike information criterion (AIC) is a relative measure of model quality. It balances fit against complexity: when comparing models, a lower AIC is better. The number is not meaningful on its own; use it to compare candidate models rather than to grade one model in isolation. section 9.1.2 section 9.4
AIC helps when an analyst adds predictors, transforms variables, or otherwise revises a regression model. A change may improve one measure, such as R-squared, without producing a better balance of fit and complexity. Compare AIC alongside the question the model must answer, its other evaluation metrics, and its diagnostic plots. section 9.1.2 section 9.2.2
Related measures answer different questions:
- R-squared describes the proportion of outcome variance explained; adjusted R-squared also penalizes additional predictors. section 9.4
- BIC also balances fit and complexity, but penalizes complexity more heavily. Prefer it when simplicity deserves greater weight. section 9.1.2
- Residual plots reveal patterns and outliers that a single model score cannot explain. section 9.2.2 section 9.4
Revising a model
In a housing-price regression, adding the number of floors as a third predictor leaves R-squared and adjusted R-squared unchanged. That is a reason to inspect relative measures such as AIC rather than assuming another predictor improves the model. In a separate rat-sightings analysis, removing an erroneous record lowers AIC and BIC; further work examines residuals and a transformation of the outcome. Neither step replaces checking the data and the remaining diagnostic patterns. section 9.1.2 section 9.2.2
import statsmodels.api as sm
import pandas as pd
housing_prices = pd.read_csv("housing_prices.csv") #1
X = housing_prices[["sq_footage", "n_bedrooms"]]
y = housing_prices["price"] #2
X = sm.add_constant(X) #3
model = sm.OLS(y, X).fit() #4
print(model.summary())
A short statsmodels workflow fits a housing-price OLS model and prints the summary used to inspect AIC alongside other results. section 9.1.2
For a stakeholder-facing prediction tool, use AIC as one input to model selection, not as a substitute for predictive accuracy, residual checks, or a usable deliverable. A product-margin modeling exercise, for example, calls for examining AIC with R-squared, BIC, and RMSE while deciding what the operations team needs. section 9.3.3 section 9.2.2


