Regression Analysis Cheat Sheet

Linear, logistic, and polynomial regression: formulas, R-squared interpretation, residual analysis, and the core assumptions every modeler must verify.

Last Updated: May 1, 2025

Linear Regression

ItemDescription
Model: y = beta0 + beta1*x + epsilonSimple linear regression — one predictor, intercept, error term
OLS Estimate: beta1 = Cov(x,y)/Var(x)Ordinary Least Squares — minimizes sum of squared residuals
R-squared = 1 - SS_residual / SS_totalProportion of variance explained: 0 to 1, higher is better fit
Adjusted R-squaredPenalizes adding useless predictors: Adj R^2 = 1 - ((1-R^2)(n-1)/(n-k-1))
RMSE = sqrt(Mean((y - yhat)^2))Root Mean Squared Error — interpretable in original units
Multiple Regression: y = X*beta + epsilonMultiple predictors — matrix form, same OLS principle

OLS Assumptions (LINE)

ItemDescription
L - LinearityRelationship between X and y is linear in parameters
I - IndependenceObservations are independent (no clustering, no autocorrelation)
N - NormalityResiduals are normally distributed (important for inference, less for prediction)
E - Equal Variance (Homoscedasticity)Constant variance of residuals across fitted values
Multicollinearity WarningPredictors highly correlated — inflates standard errors; check VIF > 10
Outliers & LeverageCook's distance > 1 flags influential points — investigate before removing

Logistic Regression

ItemDescription
Model: P(y=1) = 1 / (1 + e^(-z)) where z = beta0 + beta1*xBinary classification — output is probability between 0 and 1
Log-Odds: ln(P/(1-P)) = zLinear relationship in log-odds space — the link function
Coefficient = Log Odds Ratioe^beta = odds multiplier per unit increase in predictor
Maximum Likelihood (not OLS)Iterative fitting — no closed-form solution
Metrics: Accuracy, Precision, Recall, AUCDon't use R-squared; threshold matters for classification
Multiclass ExtensionOne-vs-rest or softmax (multinomial logistic regression)

Polynomial & Advanced

ItemDescription
Polynomial: y = beta0 + beta1*x + beta2*x^2 + ...Captures curves — degree d polynomial fits d bends
Overfitting WarningHigher degree = more wiggly; cross-validate to choose degree
Regularized: Ridge (L2), Lasso (L1)Penalty on coefficient size — Lasso does feature selection by zeroing betas
Interaction Terms: y = ... + beta_ij*x_i*x_jEffect of one predictor depends on another — synergistic effects
Pro Tip: Always plot residuals vs fitted values before trusting any regression. Patterns (funnel shapes, curves) mean your model is misspecified — no amount of R-squared can save it.