Adjusted R-squared is a regression metric that modifies R-squared to account for the number of predictors. R-squared measures the proportion of variation in an outcome explained by the predictors, but it increases when more predictors are added. Adjusted R-squared can fall if an added predictor does not improve fit enough to justify the extra complexity. section 9.1.2
Use adjusted R-squared when deciding whether a more complex regression model earns its extra predictors. It helps balance fit against complexity; it does not replace other checks. The overall F-test assesses whether predictors collectively influence the outcome, while residual plots can reveal problems that a summary score misses. section 9.1.2 section 9.2.2
Reading a model summary
A housing-price model using square footage and bedroom count reports R-squared of 0.836 and an adjusted R-squared shown as identical. In a model of daily rat-sighting calls, R-squared is 0.588 and adjusted R-squared is only marginally lower, suggesting little complexity penalty at that stage. Neither comparison alone establishes that the model is sound: inspect the remaining diagnostics and data. 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())
Fit an OLS housing-price regression in statsmodels and print its summary to find R-squared and adjusted R-squared together. section 9.1.2


