Does my model fit the data? (outcome = model + error, residual, sum of squares)
In brief
Almost every procedure of this learning path follows one idea: outcome = model + error. The model predicts a value for every person, the error is what is left over. The simplest model is the mean.
An example by hand
Five students studied 4, 10, 2, 9 and 5 hours. If nothing else is known, one predicts the same value for everybody: the mean, here 6 hours. That is a model, the simplest one.
The deviation of a person (also called residual or error) is measured minus model. For the person with 2 hours: 2 − 6 = −4. The minus means: the model predicts too much.
All deviations together always sum to 0 at the mean, because plus and minus cancel. So every deviation is squared and then added. That gives the sum of squares (SS): 4 + 16 + 16 + 9 + 1 = 46.
Why the mean?
The mean is the value for which the sum of squares is smallest (method of least squares). Any other value as a model gives a larger sum of squares. The same principle fixes the regression line.
Better models
A better model uses more knowledge, for example the group or the study hours of a person. It makes the sum of squares of the errors smaller. If it falls from 80 to 60, the model explains (80 − 60) : 80 = 25% of the spread. That is R².
How it works in Statable
- Under "Learning" open the unit for this article: first "Work it out yourself", then "Slider" with the tool "Model value".
- In a regression the result table shows R², and the table of the analysis of variance contains the sum of squares of the errors.
What is often misunderstood
- The sum of the deviations says nothing about the fit: at the mean it is always 0.
- That the sum of squares falls with a further variable does not yet show an effect: every additional variable lowers it a little, even a random number. The judgement uses adjusted R², a test and parsimony.
For specialists
Least squares minimises Σ(y − ŷ)². If the model has only a constant, ŷ is the mean. The total sum of squares splits into SS_model + SS_error, R² = SS_model : SS_total. With a constant in the model the residuals average 0 and are uncorrelated with every predictor.
Sources
Backhaus, K., Erichson, B., Gensler, S., Weiber, R. & Weiber, T. Multivariate Analysemethoden, chapter 2 (regression analysis). Bortz, J. & Schuster, C. Statistik für Human- und Sozialwissenschaftler, chapter 11.
Take away
- Outcome = model + error: the error is measured minus model.
- The mean is the simplest model and makes the sum of squares smallest.
- Deviations are squared because plus and minus would otherwise cancel.
- R² says what share of the sum of squares a better model removes.