All problems
Durbin Watson from Residuals
Problem
The Durbin-Watson statistic is sum of squared successive residual differences divided by the residual sum of squares.
Given the residual list in time order, return the statistic.
Hint
Successive differences live in the numerator, squared residuals in the denominator.
Test cases
case 1
in: [[1,-1,1,-1]]
expected: 3
case 2
in: [[0,0,1]]
expected: 1
case 3
in: [[1,0]]
expected: 1
Starter codePython
def durbin_watson_from_residuals(residuals):
# Your code here
pass3 test cases · run your code against them in the editor