678 words
3 min read
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 1 — Data types and measurement scales Statistics starts with **what you measured** and **what arithmetic means** on that measurement — before any formula. ## Week map Case vs variable → categorical vs numerical → measurement scales → valid summaries → rows/columns in tables → common misclassifi...

Statistics I · Week 1 — Data types and measurement scales
Statistics starts with what you measured and what arithmetic means on that measurement — before any formula.
Week map
Case vs variable → categorical vs numerical → measurement scales → valid summaries → rows/columns in tables → common misclassification traps.
Core vocabulary
- Case → one observed unit → one row often → student #42, Tuesday’s weather, one transaction.
- Variable → characteristic recorded per case → column →
height,major,rating. - Value → one observation of a variable for one case →
172 cm,"CS",4. - Label → name of variable → not the same as a value.
Type split
| Type | Values | Examples |
|---|---|---|
| Categorical | labels / codes | eye color, department |
| Numerical | numbers with quantity | height, count, income |
Numerical subtypes: discrete (counts) vs continuous (measurements within interval).
Measurement scales
- Nominal → categories, no order → gender codes, zip codes.
- Ordinal → ordered categories → Likert “satisfied”, medal ranks.
- Interval → differences meaningful, no true zero → Celsius temperature.
- Ratio → true zero, ratios meaningful → mass, distance, income.
Mini-examples:
- Shirt size S,M,L,XL → ordinal (order) but not ratio (L is not “twice” S).
- Year 2024 → interval-like for calendar years (no year 0 in CE) — often taught as not ratio.
- Kelvin → ratio (0 K means no thermal energy).
Valid operations (quick gate)
| Scale | Order? | Mean? | Ratio “twice as much”? |
|---|---|---|---|
| nominal | no | no | no |
| ordinal | yes | caution | no |
| interval | yes | often | no |
| ratio | yes | yes | yes |
Trap: averaging ordinal codes without justification treats them as interval.
Pattern families
Easy — Classify variable
- Given description, state categorical vs numerical.
- Pick scale for one variable with reason in one line.
- Identify case count
nfrom table rows.
Medium — Table orientation
- Rows as cases, columns as variables (usual).
- Distinguish variable name from value entry.
- Several variables same cases — joint dataset.
Hard — News headline traps
- ID numbers nominal, not “big number” numerical analysis.
- ZIP code nominal — do not average.
- Percent correct as ratio; letter grades ordinal.
Worked mini-examples
Example 1 — Classify.
Dataset: for 50 buses, record
route_id (text), passengers (count), on_time (Yes/No).route_idcategorical nominalpassengersnumerical discreteon_timecategorical nominal (binary)
Example 2 — Scale.
Variable: pain scale 0–10 where 0 means none, 10 worst. Ordered, differences somewhat meaningful — often ordinal; not ratio (10 is not “double” 5 in pain perception).
Example 3 — Celsius.
20°C to 30°C is +10°C difference. 30°C is not “1.5× heat” of 20°C in ratio sense — interval, not ratio.
Example 4 — Cases.
Table 120 rows, columns
age, city, salary → 120 cases, 3 variables.Example 5 — Invalid mean.
Average of zip codes 10001 and 10002 is meaningless — nominal.
Traps
- Confusing variable with value (“variable is John”).
- Treating student ID as numerical for correlation.
- Averaging ordinal satisfaction codes blindly.
- Ratio claims on interval scales (twice as hot in °C).
- Binary categorical treated as numerical 0/1 without context — sometimes OK for modeling, but type is still categorical.
Diagnostic (try yourself)
-
Classify each variable as categorical or numerical: (a) number of siblings, (b) favorite fruit, (c) body temperature in °F, (d) race finish position.
-
For “years of education completed”, which scale (nominal/ordinal/interval/ratio) is most appropriate? Brief reason.
-
A spreadsheet has 200 rows and 15 columns of student records. What is
n? How many variables? -
Why is “mode of zip code” silly but “mode of eye color” OK?
-
Give one example variable that is numerical discrete and one numerical continuous.