Point That Pulls Hardest
Fit an ordinary least squares line to the points (x[i], y[i]). Return the index of the point with the largest Cook's distance: the one whose removal would move the fitted line the most.
Example 1
x [1,2,3,4,5,20]
y [2,4,6,8,10,5]
returns 5
The last point sits far to the right and far below the trend of the others.
Constraints
6 <= len(x) <= 40- One point clearly pulls hardest
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More statsmodels problems
- Tangled PredictorsMedium
- Top of the CurveMedium
- Trust Some Points MoreMedium
- Uneven SpreadMedium
- Do the Effects CombineHard
- Drop the Weak OnesHard
- Effect of the ProgramHard
- Enough PeopleHard