Regression
you can feel
Every concept has a live calculator. Change a number, see the answer update instantly. No static examples — just direct interaction with the maths.
OLS objective, correlation vs causation, t-tests. Includes an R² & significance calculator.
↗Click to add points, right-click to remove. Full OLS stats update in real time. Prediction calculator included.
↗Live salary predictor with partial effects. Multicollinearity VIF explorer. Model comparison tool.
↗Generate data with specific violations, see how residual plots look and what goes wrong with inference.
↗Drag the degree slider, tune regularisation λ. Overfitting vs underfitting made visceral.
↗Switch between dataset types and watch all four R-style diagnostic plots update simultaneously.
↗What is Regression?
The core idea, OLS, correlation vs causation, and inference — with a live significance calculator
Regression asks: "If I know X, how well can I predict Y?" You have data, you draw the best possible straight line through it, and that line becomes your model. Given a new X, you read off the predicted Y. Everything else in regression is refinement of this simple idea.
You're a coffee shop owner. Hotter days → more iced coffees sold. You plot temperature vs cups sold. Regression finds the best line — the one that minimises total prediction error. Now you can order the right amount of coffee for tomorrow based on the weather forecast.
What you're predicting
The dependent variable / outcome / target. House price, test score, blood pressure. Goes on the vertical axis.
What you're using to predict
The independent variable / feature / covariate. House size, hours studied, dosage. Goes on the horizontal axis.
The effect size
How much Y changes per unit of X. The slope. This is usually what you care about — it quantifies the relationship.
What the model gets wrong
Actual Y minus predicted Ŷ. Good models have small, random residuals. Patterned residuals signal a missing variable or wrong model form.
OLS (Ordinary Least Squares) finds the line that minimises the sum of squared vertical distances from each point to the line. "Squared" punishes big errors more than small ones, and makes the loss function smooth so calculus can find the exact minimum.
Drag the slope and intercept to see how RSS changes. OLS finds the unique (β₀, β₁) that minimises RSS.
Correlation (−1 to +1) measures linear association strength. Regression gives a predictive equation. But neither implies causation — that requires experiments, instrumental variables, or other causal methods.
Adjust the sliders to generate data with a specific correlation. See how the regression line and R² change.
Enter your regression output — get p-values, confidence intervals, and a plain-English verdict instantly.
Adjust the sliders to explore how β̂₁, SE, and n jointly determine significance.
One line, live
Click the canvas to add data — OLS fits instantly with full statistics and a prediction calculator
Click anywhere on the chart to add data points. The OLS regression line fits immediately. Right-click to remove a point. Watch what happens to slope, R², and the prediction calculator when you add an outlier.
PI vs CI: Prediction interval (wider) covers a single new observation. Confidence interval (narrower) covers the mean of Y at that X.
Many predictors, one model
Live salary calculator, partial effects decomposition, and VIF multicollinearity explorer
This model predicts salary from four inputs. Every slider updates the prediction, equation, and waterfall chart instantly. The chart shows each variable's contribution — the "partial effect" of each predictor while controlling for the others.
VIF (Variance Inflation Factor) measures how much a predictor is explained by the others. VIF = 1 is perfect independence. VIF > 10 means severe multicollinearity — your coefficient estimates become wildly unstable.
Drag the correlation between predictors. Watch how VIF, standard errors, and coefficient stability all respond.
Penalised goodness of fit
R² always rises when you add variables. Adjusted R² penalises each extra parameter. Use this when comparing models of different sizes.
Are any predictors useful?
Tests H₀: all β₁=...=βₚ=0. A significant F-test means at least one predictor is useful — but doesn't tell you which.
When does it break?
Simulate specific violations — see the residual plots and quantify how inference goes wrong
When a line isn't enough
Logistic regression, polynomial overfitting, and regularisation — all live
Logistic regression is for binary outcomes (yes/no, pass/fail). A sigmoid function squashes the linear prediction into a probability between 0 and 1. The threshold you choose trades off false positives vs false negatives.
Polynomial regression adds X², X³ etc. as predictors — still "linear regression" (linear in parameters). The danger: high degree = overfitting. The model memorises training noise. Watch R² → 1 on training data while the curve goes wild.
Ridge (L2) shrinks all coefficients toward zero. Lasso (L1) can shrink some to exactly zero — automatic variable selection. Higher λ = more shrinkage = less overfitting but more bias. The sweet spot is found by cross-validation.
Coefficient values as λ increases — Ridge shrinks, Lasso zeros out
Train vs Test error — find the λ that minimises test error
Is my model any good?
All four R diagnostic plots, live. Switch dataset type and watch them all update simultaneously.
—
—
—
—
Test Your Understanding
12 questions — interpretation, theory, scenarios, and diagnostics