~/ learn/ afm-113/ cards/ Pearson r and what it means
1 of 5

Compute the two sample standard deviations and r = s_xy/(s_x s_y) for the eight clients, and confirm against statistics.correlation.

Compute the two sample standard deviations and r = s_xy/(s_x s_y) for the eight clients, and confirm against statistics.correlation.

Answer

import statistics as st income = [35, 48, 52, 61, 70, 84, 95, 110] score = [610, 645, 640, 680, 700, 720, 745, 760] sx = st.stdev(income) sy = st.stdev(score) r = st.covariance(income, score) / (sx * sy) print(f"sx={sx:.4f} sy={sy:.4f} r={r:.4f}") print(f"statistics.correlation={st.correlation(income, score):.4f}")

IBS1 §13.1, IS1 §12.3 (properties of r), CC BY 4.0 — shape only; S21 W3 handout (interpretation sentence — shape only); original dataset

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/bb56523e-4754-4343-b050-a1055ec0efa2/flashcard utf-8 LF