All problems
Cook's Distance One Point
Problem
Cook's distance for a simple regression point is D = (r^2 / (p * MSE)) * h / (1 - h)^2 with p predictors including intercept = 2.
Given the residual r, the MSE, and the leverage h, return D.
Hint
High leverage amplifies the influence of a residual.
Test cases
case 1
in: [1,1,0.1]
expected: 0.06172839506172839
case 2
in: [2,4,0.5]
expected: 1
case 3
in: [0,1,0.2]
expected: 0
Starter codePython
def cooks_distance_one_point(residual, mse, leverage):
# Your code here
pass3 test cases · run your code against them in the editor