Skip to main content
Albero Academy

Beyond Simple Regression

Model with many inputs — multiple regression, interpreting coefficients, logistic regression for yes/no outcomes, and overfitting.

Chapter 14Statistics15 min readBeginner friendly
  • #Statistics
  • #Regression
  • #Modelling

Chapter 4 fit a line to one predictor. Real outcomes depend on many factors. Multiple regression extends the idea to several predictors, and logistic regression handles yes/no outcomes — the two workhorses of practical modelling and the bridge to machine learning.

Multiple regression

Multiple regression predicts a numeric outcome from several inputs at once, estimating the effect of each while holding the others constant:

several predictors
# package = b0 + b1·experience + b2·projects + b3·skills + error
import statsmodels.formula.api as smf
model = smf.ols("package ~ experience + projects + skills", data=df).fit()
model.summary() # coefficients, p-values, R²

Interpreting coefficients

  • Each coefficient is the effect of that predictor holding the others constant (+1 year experience → +₹X, all else equal).
  • Its p-value says whether that effect is statistically distinguishable from zero.
  • R² is the share of the outcome's variation the model explains.

Logistic regression

When the outcome is categorical (placed / not placed), linear regression is wrong — you can't predict a 0/1 with a straight line. Logistic regression predicts a probability instead, and is the classic classification model:

predicting a probability
from sklearn.linear_model import LogisticRegression
model = LogisticRegression().fit(X, y) # y is 0/1
model.predict_proba(X_new) # probability of the positive class

Overfitting & assumptions

Practice

Fit a multiple regression of package on experience, projects and skills; interpret one coefficient "holding others constant" and read the R². Then fit a logistic regression predicting placement (0/1) and interpret a predicted probability.

Key takeaways

  1. 01Multiple regression predicts a numeric outcome from several predictors at once.
  2. 02Each coefficient is that predictor's effect holding the others constant; R² is variation explained.
  3. 03Logistic regression predicts a probability for categorical (yes/no) outcomes — a classifier.
  4. 04More predictors always raise training R² — beware overfitting; validate on held-out data.
  5. 05Regression assumes linearity, independent errors and no severe multicollinearity.