~/ learn/ afm-113/ cards/ Variance and standard deviation
1 of 6

Build the two sums for the six audit-hour totals, compute the variance by the shortcut form, and print the sample SD beside the population SD so the n − 1 versus n gap is visible.

Build the two sums for the six audit-hour totals, compute the variance by the shortcut form, and print the sample SD beside the population SD so the n − 1 versus n gap is visible.

Answer

import statistics as st hrs = [42, 38, 51, 45, 39, 49] n = len(hrs) sx = sum(hrs) sxx = sum(x * x for x in hrs) var = (sxx - n * (sx / n) ** 2) / (n - 1) print(f"sum={sx} sumsq={sxx} var={var:.4f}") print(f"sd={st.stdev(hrs):.4f} pstdev={st.pstdev(hrs):.4f}")

BCc ch 1 (two justifications for n − 1); IBS1 §2.7 (deviation form), CC BY 4.0 — shape only; S21 W3 handout (shortcut form, shape only); original dataset

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/eb7d59f4-0c1b-4a1d-8e27-284c37a0fde1/flashcard utf-8 LF