Quiz 2

632 words
3 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Statistics I · Week 4 — Association and correlation Two variables together: **tables** for categorical pairs, **scatterplots** and **$r$** for numerical pairs. Association is not causation.

Statistics I · Week 4 — Association and correlation

Two variables together: tables for categorical pairs, scatterplots and rr for numerical pairs. Association is not causation.

Week map

Two variables → contingency table → marginal totals → scatterplot features → correlation rr → strength vs direction → limitations of rr.

Contingency table notation

  • Contingency table → cross-classified counts → rows = one variable, columns = another.
  • Cell → count in one row category AND one column category.
  • Marginal total → row or column sum → not joint.
  • Joint → specific pair; marginal → one variable alone.
Mini-table (transport × gender, counts):
BusTrainTotal
F302050
M252550
Total5545100
Cell (F, Train) = 20. Marginal female total = 50.

Scatterplot language

For numerical xx and yy:
  • Direction → positive (upward), negative (downward), none.
  • Form → linear, curved, clusters.
  • Strength → tight cloud vs scattered.
  • Outliers → points off main pattern.
Mini-description: “positive, roughly linear, moderate strength, one high outlier.”

Correlation rr

  • rr → Pearson correlation coefficient → measures linear association.
  • Range 1r1-1 \le r \le 1.
  • r1r \approx 1 → tight increasing line.
  • r1r \approx -1 → tight decreasing line.
  • r0r \approx 0 → weak linear pattern (curved pattern may still exist).
Trap: rr is not steepness of slope — standardized measure of linear fit strength/direction.
Properties (linear world):
  • Sign of rr matches slope of best-fit line.
  • rr unchanged if you add constant to all xx or scale xx by positive constant (linear transform).

Association vs causation

Pattern may be due to:
  • Direct cause
  • Confounding third variable
  • Coincidence
Ice cream sales and drowning correlate — weather confounds both.

Pattern families

Easy — Read contingency cell

  • Identify joint count.
  • Compute marginal from table.
  • Percent of total in one cell: cell/n.

Medium — Describe scatter

  • State direction, form, strength in words.
  • Match sign of rr to scatter direction.
  • Spot outlier effect on rr.

Hard — Interpret rr and limits

  • Near ±1 vs near 0 interpretation.
  • Strong nonlinear pattern with rr near 0.
  • Do not infer causation from rr.
  • Categorical coded as numbers — rr may mislead.

Worked mini-examples

Example 1 — Cell percent.
From table above: percent female bus riders = 30/100 = 30% of all, or 30/50 = 60% of females.
Example 2 — Scatter words.
Points rise left to right tightly → positive, linear, strong.
Example 3 — rr sign.
r=0.82r = -0.82 → strong negative linear association.
Example 4 — Nonlinear trap.
Parabolic cloud around 0 → rr might be near 0 though yy clearly depends on xx.
Example 5 — Outlier.
Most points tight positive line; one far low point pulls rr down.

Traps

  • Causation from correlation.
  • rr for categorical disguised as numbers (zip codes).
  • Confusing strength with steep slope.
  • Ignoring outliers dominating rr.
  • Contingency cell vs marginal confusion.

Diagnostic (try yourself)

  1. In a 2×3 contingency table, what does a single cell count represent?
  2. Describe in words a scatterplot that is negative, linear, and weak.
  3. If r=0.15r = 0.15 between study hours and exam score, is linear association strong or weak? Does high score cause more hours?
  4. Table: exercise (Low/High) × health (Poor/Good). Low-Poor cell = 40, total n=200n=200. What percent of all cases are Low and Poor?
  5. A U-shaped scatter has r0r \approx 0. Can yy still depend on xx? Explain briefly.
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.