SSE stands for sum of squared errors, also called the sum of squared residuals (SSR). It is a standard statistical quantity that measures the total squared difference between observed values and the values predicted by a model. In regression analysis, SSE is the part of the total variation in the data that the model fails to explain. A smaller SSE indicates that the model's predictions are closer to the actual data points, while a larger SSE indicates larger prediction errors. SSE is not a slang term or an abbreviation used informally; it is a formal technical acronym in statistics and machine learning.
Background and Origin of SSE
The concept behind SSE comes from the method of least squares, developed in the early 19th century by mathematicians including Legendre and Gauss. The goal was to fit a line or curve to data by minimizing the sum of squared vertical distances from each point to the line. Squaring the errors prevents positive and negative errors from canceling out and gives more weight to larger errors. Over time, SSE became a standard notation in regression textbooks and statistical software. The term is sometimes written as SSE, sometimes as SSR (sum of squared residuals), and occasionally as RSS (residual sum of squares). All three refer to the same quantity in ordinary least squares regression, though notation can vary across software packages and fields.
How SSE Is Calculated
For a set of n observations, let yi be the actual value and ŷi be the predicted value from the model. The error (residual) for observation i is ei = yi − ŷi. SSE is the sum of the squared residuals:
SSE = Σ (yi − ŷi)2
For example, suppose a model predicts values 3, 5, and 7 for three observations whose actual values are 2, 6, and 8. The residuals are −1, 1, and 1. Squaring gives 1, 1, and 1, so SSE = 3. If the predictions were 4, 5, and 6, the residuals would be −2, 1, and 2, giving squared errors 4, 1, and 4, so SSE = 9. The second model has a larger SSE and fits the data worse in the least-squares sense.
SSE in Regression and ANOVA
In simple linear regression, the total sum of squares (SST) measures the total variation in the response variable around its mean. SST splits into two parts: the sum of squares due to regression (SSR, sometimes called explained sum of squares) and the sum of squared errors (SSE). The relationship is:
SST = SSR + SSE
Here SSR is the variation explained by the model, and SSE is the unexplained variation. The coefficient of determination, R², is defined as 1 − SSE/SST. An R² of 0.80 means that 80% of the total variation is explained by the model, leaving 20% in SSE. In analysis of variance (ANOVA), SSE is the within-group sum of squares, representing variation inside groups that the group means do not explain.
How SSE Is Used in Practice
SSE appears in several common statistical tasks:
- Model fitting: Least-squares regression chooses coefficients that minimize SSE. Software reports SSE as part of the regression output.
- Model comparison: When comparing models on the same data and same response variable, a lower SSE generally indicates a better fit, though adding predictors almost always lowers SSE and can lead to overfitting.
- Estimating error variance: The mean squared error (MSE) is SSE divided by its degrees of freedom, usually n − p for a model with p parameters. MSE estimates the variance of the residuals.
- Standard errors: The standard error of the regression is the square root of MSE, and it is used in confidence intervals and hypothesis tests for regression coefficients.
SSE is also used in non-regression contexts, such as clustering, where it measures the compactness of clusters, and in machine learning as a loss function for regression models.
Common Misconceptions and Pitfalls
One common misconception is that SSE alone can tell you whether a model is good. SSE depends on the scale of the response variable and the number of observations, so it is not comparable across datasets with different units or sizes. A model with SSE = 100 may fit better than one with SSE = 10 if the response variable is measured in different units or has much larger variance. For this reason, R², MSE, and root mean squared error (RMSE) are often more interpretable. Another pitfall is that adding predictors to a regression model can never increase SSE in ordinary least squares; it can only stay the same or decrease. Therefore, a lower SSE does not automatically mean a better model, because it may reflect overfitting. Adjusted R² or cross-validation is needed to compare models with different numbers of predictors. Finally, SSE is sensitive to outliers because squaring amplifies large errors. A single extreme point can dominate SSE and distort the fit.
SSE vs. Other Error Measures
SSE is one of several ways to summarize prediction error. The table below compares it with related measures.
- SSE: Sum of squared errors. Units are squared units of the response variable. Used in least-squares fitting and ANOVA.
- MSE: Mean squared error, SSE divided by degrees of freedom. Units are squared units. Used to estimate error variance.
- RMSE: Root mean squared error, the square root of MSE. Units match the response variable. Often easier to interpret.
- MAE: Mean absolute error, the average of absolute residuals. Less sensitive to outliers than SSE or MSE.
- SSR: In some texts, SSR means sum of squared residuals (same as SSE), while in others it means regression sum of squares. Always check the definition used in a given source.
Because notation varies, it is important to read the definitions in each textbook or software manual. In R, for example, the deviance of a linear model is SSE, and the anova function reports the residual sum of squares. In Python's statsmodels, the ssr attribute often refers to the sum of squared residuals.
Frequently Asked Questions
Is SSE the same as SSR?
Often yes, but not always. In many statistics texts, SSR stands for sum of squared residuals, which is identical to SSE. In other texts, SSR stands for regression sum of squares, the explained part of the variation. The context and the formula used will clarify which meaning applies.
Can SSE be negative?
No. SSE is a sum of squared real numbers, so it is always zero or positive. It equals zero only when every residual is zero, meaning the model fits all data points exactly.
What is a good SSE value?
There is no universal threshold. SSE depends on the scale of the data and the number of observations. It is meaningful mainly for comparing models on the same dataset and response variable. For interpretation, R², RMSE, or MSE are usually more useful.
Does a lower SSE always mean a better model?
Not necessarily. Adding predictors can only reduce or maintain SSE in ordinary least squares, so a lower SSE may reflect overfitting rather than genuine improvement. Use adjusted R², information criteria, or cross-validation to compare models with different complexity.
How is SSE related to R-squared?
R² = 1 − SSE/SST, where SST is the total sum of squares. So SSE is the unexplained variation, and R² is the proportion of total variation that the model explains. A model with SSE = 0 has R² = 1 and fits the data perfectly.
Is SSE used outside regression?
Yes. SSE appears in ANOVA as the within-group sum of squares, in clustering as a measure of cluster compactness, and in machine learning as a loss function for regression. The core idea—summing squared differences between observed and predicted values—is broadly applicable.