Evaluating Linear Regression Models
What you'll learn: How to measure whether your linear regression model makes good predictions using R-squared, RMSE, and residual analysis.
Why Evaluation Matters
You've trained a linear regression model—but is it any good? Without proper evaluation metrics, you can't distinguish between a model that captures real patterns and one that's essentially guessing. Think of it like grading a student's test: you need clear scoring criteria.
Core Evaluation Metrics
R-Squared (Coefficient of Determination)
R-squared tells you what percentage of variance in your target variable the model explains. It ranges from 0 to 1 (or 0% to 100%). An R² of 0.85 means your model explains 85% of the variation in the data—the remaining 15% is noise or missing factors. Higher is generally better, but perfect 1.0 scores often signal overfitting.
RMSE (Root Mean Squared Error)
RMSE measures the average magnitude of prediction errors in the same units as your target variable. If you're predicting house prices in dollars, RMSE tells you "on average, predictions are off by $X." Lower RMSE means better predictions. Unlike R-squared, RMSE gives you an interpretable error amount.
Residual Analysis
Residuals are the differences between actual and predicted values. Plotting residuals reveals whether your model's assumptions hold:
- Random scatter around zero: Good—your model captures the pattern
- Clear patterns or curves: Your model is missing something (maybe non-linear relationships)
- Funnel shapes: Indicates heteroscedasticity (variance isn't constant)
Key Takeaway: Use R-squared to understand explanatory power, RMSE to quantify prediction accuracy in real units, and residual plots to diagnose model assumptions—together they reveal whether your linear regression truly fits the data or needs refinement.