Trusted answers to developer questions

The residual sum of squares

Free System Design Interview Course

Many candidates are rejected or down-leveled due to poor performance in their System Design Interview. Stand out in System Design Interviews and get hired in 2024 with this popular free course.

A residual sum of squares (RSS), also known as the sum of squared residuals (SSR), is a statistical technique used to measure the amount of variance in a data set that is not explained by a regression model. It is the sum of the squared values of the residuals (deviations of predicted from actual empirical values of data).

Forumula for SSR (or RSS)
Forumula for SSR (or RSS)

yiy_i is the ithi^{th} actual value from data, yi^\hat{y_i} is the ithi^{th} predicted value using regression, and aa and bb are constants.

In the graph shown, residualthe difference between the predicted and actual value is represented by the yellow lines.

SSR is the total sum of the squares of these residuals (yellow lines).

svg viewer

Example

Given the set of values:

XX YY
0 1
1 2
2 6
3 7
4 8

and with a=1a=1 and b=2b=2, we will get the following result:

RSS=(1(1+(20)))2+(2(1+(21)))2+(6(1+(22)))2+(7(1+(23)))2+(8(1+(24)))2RSS = (1-(1+(2*0)))^2+ (2-(1+(2*1)))^2 + (6-(1+(2*2)))^2 + (7-(1+(2*3)))^2 + (8-(1+(2*4)))^2

RSS=3RSS = 3

RELATED TAGS

statistics
data science
regression
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?