~/ learn/ afm-113/ cards/ Outliers, influential points, and refitting
1 of 4

Fit the line with and without the ninth client (150, 600) and print r and the slope for each, to see one point turn r = 0.986 into 0.186.

Fit the line with and without the ninth client (150, 600) and print r and the slope for each, to see one point turn r = 0.986 into 0.186.

Answer

import statistics as st income = [35, 48, 52, 61, 70, 84, 95, 110] score = [610, 645, 640, 680, 700, 720, 745, 760] with_9 = (income + [150], score + [600]) for label, (x, y) in [("with", with_9), ("without", (income, score))]: r = st.correlation(x, y) slope = st.linear_regression(x, y).slope print(f"{label}: r={r:.3f} slope={slope:.3f}")

IS1 §12.6 (2s rule, influential points), CC BY 4.0 — shape only; S21 W3 handout (refit demonstration — shape only); original dataset

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/effca8a0-c1ab-4bd7-8f50-1268c5d60e7e/flashcard utf-8 LF