Before any method, one fork decides everything — and underneath both lies a single idea: a line that makes its mistakes as small as possible.
This is the single most common methodological error in a DBA. Deciding how you will analyse data is not a technical afterthought — it is a methodological choice that must be justified before you collect a single response, exactly like your epistemological stance or your sampling strategy.
And almost every quantitative analysis you will ever run answers one of two fundamentally different questions. Confusing them is what makes a viva go badly.
Switch between the two goals below. Notice that the question, the output you report, the success metric, and even the methods all change. They are different intellectual projects.
A DBA almost always explains. You want to understand and influence a business reality — not just forecast it.
Suppose you have data on marketing spend (x) and sales (y) for 8 months. Plot them and the dots roughly trend upward. A linear model proposes the simplest possible story:
The whole game is choosing b₀ and b₁ so the line sits as close as possible to the real dots. Try it: drag the two sliders and hunt for the best line by eye.
For each month, the residual is what the line got wrong:
We can't just add the residuals up — positive and negative errors would cancel, and a terrible line could score zero. Two fixes exist: take absolute values, or square them. We square. Squaring does two things: it makes every error positive, and it punishes big misses far more than small ones (an error of 4 counts as 16). The line that makes this total as small as possible is the Ordinary Least Squares (OLS) line:
The interactive below makes the squaring literal: each residual becomes an actual square. Watch the total grey area — that area is the SSE. The best line is the one with the least total area. That is not a metaphor; it is the definition.
lm(sales ~ spend, data=df). In Python (statsmodels): smf.ols("sales ~ spend", df).fit(). In Excel: Data → Data Analysis → Regression.You now know the engine under the hood: a model is a line, and "fitting" means choosing the line whose squared mistakes are smallest.