What will I learn?
What does it mean to fit a line through data points — and why is exactly
one line the "best"? This tool answers that in three steps:
- What is a regression line — and how do you read a and b?
- What are residuals — and why do we square them (RSS)?
- How does OLS minimize RSS — and what does that mean geometrically?
- What are conditional normal distributions along the line?
Step by step
- Draw data points — click in the field. 8–15 points are enough.
- Fit the line yourself — adjust a and b with the sliders.
Watch the RSS: when does it get smaller?
- Reveal OLS — click "★ Show best OLS line". Your blue line
remains visible: compare it directly with the optimal one.
Tip: enable
Conditional distributions in the OLS step — the small bell curves
show what the model assumes about the spread.
What do the statistics mean?
RSS (Residual Sum of Squares) = Σ(y − ŷ)² — sum of squared deviations.
OLS minimizes this value exactly.
R² — proportion of variance in y explained by x. R²=1: perfect prediction.
R²=0: the line explains nothing.
σ — estimated spread of residuals. In a Bayesian model, σ corresponds to
the prior on the error distribution:
y ~ Normal(μ, σ).
Why this matters for Bayes
The linear model is the starting point for everything that follows. In the Bayesian context:
OLS is equivalent to maximum likelihood under a normal distribution. Once priors are added,
this becomes Bayesian regression — with the same residual concept.
Next → Maximum Likelihood: why OLS and MLE
yield the same result under normality