Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-344

Residual Sum of Squares from Slope

Problem

For simple regression, SSE = Syy - slope * Sxy, where Syy and Sxy are the centered sums.

Given Syy, Sxy, and the fitted slope, return SSE.

Hint

The slope explains part of the total variation.

Test cases

case 1
in: [10,5,1.5]
expected: 2.5
case 2
in: [4,4,1]
expected: 0
case 3
in: [8,0,2]
expected: 8
Starter codePython
def residual_sum_of_squares_from_slope(syy, sxy, slope):
    # Your code here
    pass

3 test cases · run your code against them in the editor