Math Atlas

대푯값과 상자그림Center, Spread & Box Plots

Algebra 1Algebra 1 · 9. 자료 분석 기초9. Data Analysis Basics

학습 목표
  • 평균·중앙값·최빈값을 구하고, 자료의 성격에 따라 어느 대푯값이 적절한지 판단한다.
  • 사분위수와 IQR을 구하고 상자그림을 그리고 읽는다.
  • 1.5×IQR1.5 \times \text{IQR} 규칙으로 이상값을 판정한다.

자료 더미를 수 하나로

자료 백 개를 통째로 들고 다닐 수는 없다 — "이 자료는 대략 어디쯤에 있는가"를 수 하나로 요약한 것이 대푯값이다. 세 가지가 표준 장비다.

정의평균, 중앙값, 최빈값

평균(mean): 모든 자료의 합을 개수로 나눈 값. 중앙값(median): 자료를 크기순으로 늘어놓았을 때 한가운데 값 — 개수가 짝수면 가운데 두 값의 평균. 최빈값(mode): 가장 자주 나타나는 값.

자료 3,7,7,9,143, 7, 7, 9, 14라면: 평균 405=8\frac{40}{5} = 8, 중앙값 77(셋째 값), 최빈값 77. 셋이 비슷하면 평화롭지만, 갈라질 때 진짜 이야기가 시작된다.

평균은 이상값에 끌려간다

어느 회사 직원 1010명의 연봉이 99명은 30003000만 원, 사장 11명만 33억 원이라 하자. 평균은

9×3000+3000010=5700010=5700만 원\frac{9 \times 3000 + 30000}{10} = \frac{57000}{10} = 5700 \text{만 원}

— "평균 연봉 57005700만 원"은 산술적으로 참이지만, 직원 1010명 중 99명의 연봉보다 거의 두 배 높은 수다. 중앙값은? 크기순 55번째·66번째가 모두 30003000이므로 30003000만 원 — 보통 직원의 형편을 훨씬 정직하게 말해 준다.

교훈: 평균은 모든 값을 반영하는 만큼, 극단값 하나에도 끌려간다. 중앙값은 순서만 보므로 이상값에 둔감하다. 연봉·집값처럼 한쪽으로 크게 쏠린 자료의 "보통"은 중앙값이, 고르게 퍼진 자료의 요약은 평균이 맡는 것이 관례다. 최빈값은 수치가 아닌 자료(가장 많이 팔린 신발 사이즈)에서 유일한 선택지가 된다.

흩어짐도 요약한다 — 사분위수

대푯값이 "어디쯤"이라면, 산포는 "얼마나 흩어져 있는가"다. 가장 거친 척도는 범위(최댓값 - 최솟값)지만, 양 끝 두 점만 보므로 이상값에 취약하다. 더 단단한 도구는 자료를 넷으로 가르는 사분위수다.

시험 점수 1111개를 크기순으로 늘어놓자:

62,65,70,71,74,76,78,80,84,88,9462, 65, 70, 71, 74, \underline{76}, 78, 80, 84, 88, 94

  • 중앙값 Q2=76Q_2 = 76 (여섯째 값).
  • 제1사분위수 Q1Q_1: 중앙값 아래쪽 절반 62,65,70,71,7462, 65, \underline{70}, 71, 74의 중앙값 =70= 70.
  • 제3사분위수 Q3Q_3: 위쪽 절반 78,80,84,88,9478, 80, \underline{84}, 88, 94의 중앙값 =84= 84.

(자료 개수가 홀수일 때 중앙값 자신을 양쪽 절반에 넣지 않는 방식을 쓴다 — 다른 관례도 있으나 이 책에서는 이 방식으로 통일한다.) 가운데 50%50\%가 들어 있는 구간의 길이

IQR=Q3Q1=8470=14\text{IQR} = Q_3 - Q_1 = 84 - 70 = 14

사분위 범위라 한다. 범위와 달리 양 끝 25%25\%씩을 잘라내고 재므로 이상값에 강하다.

상자그림 — 다섯 수로 그린 초상화

최솟값, Q1Q_1, 중앙값, Q3Q_3, 최댓값 — 이 다섯 수 요약을 수직선 위에 그린 것이 상자그림(box plot)이다:

62 70 76 84 94 60 70 80 90 100
다섯 수 요약 62, 70, 76, 84, 94의 상자그림 — 상자가 가운데 50%를, 수염이 양 끝을 나타낸다

상자가 가운데 50%50\%(Q1Q3Q_1{\sim}Q_3), 상자 속 선이 중앙값, 양쪽 수염이 최솟값·최댓값까지다. 그림 하나에서 많은 것이 읽힌다: 오른쪽 수염이 길면 큰 쪽으로 꼬리가 긴 자료이고, 상자가 좁으면 가운데 절반이 촘촘히 모여 있다. 여러 반의 점수를 비교할 때 상자그림을 나란히 세우면 분포끼리의 비교가 한눈에 끝난다.

이상값의 공식적 기준 — 1.5×IQR1.5 \times \text{IQR} 규칙

"뚝 떨어진 값"을 눈대중이 아니라 규칙으로 판정할 수도 있다:

Q11.5×IQR  보다 작거나  Q3+1.5×IQR  보다 크면 이상값.Q_1 - 1.5 \times \text{IQR} \;\text{보다 작거나}\; Q_3 + 1.5 \times \text{IQR} \;\text{보다 크면 이상값.}

위 자료라면 울타리가 7021=4970 - 21 = 4984+21=10584 + 21 = 105 — 모든 점수(629462{\sim}94)가 안쪽에 있으니 이상값 없음. 만약 4040점짜리 자료가 하나 있었다면 4949 아래이므로 이상값 판정을 받는다. (1.51.5라는 계수는 실무 경험에서 자리 잡은 관례다 — 대부분의 통계 소프트웨어가 이 기준으로 상자그림에 이상값을 별도 표시한다.)

어느 요약을 쓸 것인가

요약은 정보를 버리는 일이다 — 무엇을 버려도 되는지가 자료마다 다르니, 도구를 고르는 판단이 계산만큼 중요하다. 쏠린 자료의 "보통"은 중앙값, 대칭 자료의 요약과 추가 계산(총합 복원 등)은 평균, 범주 자료는 최빈값, 흩어짐은 IQR(이상값이 있으면 범위 대신). 이 판단력이 이 차시의 진짜 목표다.

문제 탭에는 대푯값·사분위수 기본기부터 상자그림 읽기, 평균의 성질, 두 반 합친 평균, 조건을 만족하는 자료 구성, 그리고 "평균을 22점 올리려면 몇 점이 필요한가"(경시)까지 열세 문제가 있다.

Goals
  • Compute mean, median, and mode, and judge which measure of center suits which data.
  • Find quartiles and the IQR, and draw and read box plots.
  • Apply the 1.5×IQR1.5 \times \text{IQR} rule to flag outliers.

A pile of data, summarized in one number

Nobody carries a hundred data points around whole — a measure of center compresses "roughly where does this data sit" into one number. Three are standard equipment.

DefinitionMean, median, mode

Mean: the sum of all values divided by their count. Median: the middle value when the data are sorted — with an even count, the average of the two middle values. Mode: the most frequent value.

For the data 3,7,7,9,143, 7, 7, 9, 14: mean 405=8\frac{40}{5} = 8, median 77 (the third value), mode 77. When the three agree, all is calm; the real story starts when they split.

The mean gets dragged by outliers

Suppose a company's ten salaries are 30,000,00030{,}000{,}000 won for nine employees and 300,000,000300{,}000{,}000 for the boss. The mean is

9×3000+3000010=5700010=5700 (units of 104 won)\frac{9 \times 3000 + 30000}{10} = \frac{57000}{10} = 5700 \text{ (units of } 10^4 \text{ won)}

— "average salary 57,000,00057{,}000{,}000 won" is arithmetically true, yet nearly double what nine of the ten people earn. The median? The 5th and 6th sorted values are both 30003000, so 30,000,00030{,}000{,}000 won — a far more honest picture of the typical employee.

The lesson: the mean reflects every value, and is therefore dragged by any single extreme. The median sees only order, so outliers barely move it. Convention follows: for lopsided data (salaries, home prices) the "typical" is the median's job; for evenly spread data, the mean's; and for non-numeric data (the best-selling shoe size), the mode is the only choice.

Summarizing spread: quartiles

If center answers "where," spread answers "how scattered." The crudest measure is the range (max - min), but it looks only at the two endpoints and is fragile to outliers. The sturdier tool cuts the data into four parts — the quartiles.

Sort eleven test scores:

62,65,70,71,74,76,78,80,84,88,9462, 65, 70, 71, 74, \underline{76}, 78, 80, 84, 88, 94

  • Median Q2=76Q_2 = 76 (the sixth value).
  • First quartile Q1Q_1: the median of the lower half 62,65,70,71,7462, 65, \underline{70}, 71, 74, namely 7070.
  • Third quartile Q3Q_3: the median of the upper half 78,80,84,88,9478, 80, \underline{84}, 88, 94, namely 8484.

(With an odd count, we exclude the median itself from both halves — other conventions exist, but this book uses this one throughout.) The length of the interval holding the middle 50%50\%,

IQR=Q3Q1=8470=14,\text{IQR} = Q_3 - Q_1 = 84 - 70 = 14,

is the interquartile range. Unlike the range, it trims 25%25\% off each end before measuring, making it robust to outliers.

The box plot: a portrait in five numbers

Minimum, Q1Q_1, median, Q3Q_3, maximum — this five-number summary, drawn over a number line, is a box plot:

62 70 76 84 94 60 70 80 90 100
The box plot of the five-number summary 62, 70, 76, 84, 94 — the box holds the middle 50%, whiskers reach the extremes

The box spans the middle 50%50\% (Q1Q_1 to Q3Q_3), the line inside marks the median, and the whiskers reach the minimum and maximum. One picture yields a lot: a long right whisker means a tail stretching high; a narrow box means a tightly packed middle half. Stack several classes' box plots side by side and the distributions compare at a glance.

An official standard for outliers: the 1.5×IQR1.5 \times \text{IQR} rule

"Far-off values" can be judged by rule rather than eye:

a value below Q11.5×IQR or above Q3+1.5×IQR is an outlier.\text{a value below } Q_1 - 1.5 \times \text{IQR} \text{ or above } Q_3 + 1.5 \times \text{IQR} \text{ is an outlier.}

For the data above the fences are 7021=4970 - 21 = 49 and 84+21=10584 + 21 = 105 — every score (62629494) sits inside, so no outliers. Had there been a 4040, it would fall below 4949 and be flagged. (The factor 1.51.5 is a convention settled by practice — most statistical software marks box-plot outliers by exactly this criterion.)

Choosing the summary

Summarizing means throwing information away — and which information is safe to discard differs by dataset, so choosing the tool matters as much as computing it. Lopsided data's "typical": the median. Symmetric data, or any use requiring totals back: the mean. Categorical data: the mode. Spread: the IQR when outliers lurk, in place of the range. That judgment is this lesson's real goal.

The problems tab runs from center-and-quartile basics through box-plot reading, properties of the mean, combining two classes' averages, constructing data to specification, and the contest question "what score raises my average by 22?" — thirteen problems.