Repository navigation
0.1 Measurement Scales & Variable Types
Julio Toboso edited this page Oct 25, 2025
·
4 revisions
Purpose: choose the right summaries and charts by naming what your data is.
-
Categorical or Cualitative
- Nominal (no order): color, country, user_id (identifier, not a “category” for averaging).
- Ordinal (order, uneven steps): low/med/high, Likert 1–5.
-
Numeric
- Interval (equal steps, no true zero): °C, dates.
- Ratio (equal steps, true zero): length, income, counts.
- Boolean: Logic (True/False)
- Specials: datetime, text, geospatial, images.
| Scale | Allowed ops (examples) | Typical stats | Typical visuals |
|---|---|---|---|
| Nominal | =, ≠, mode, counts | Mode, frequency % | Bar chart, stacked bars |
| Ordinal | order comparisons (<, >), median | Median, percentiles | Ordered bars, dot plot |
| Interval | +/−, mean differences | Mean, SD, z-scores | Line (time), histogram |
| Ratio | ×/÷, geometric mean, CV | Mean, SD, ratios, rates | Histogram, box plot, scatter |
Heuristic: position > length > angle/area > color for quantitative precision.
- IDs as categories: never average an identifier; use for joins/keys only.
- Ordinal ≠ Interval: a 4 isn’t “twice” a 2 on a Likert scale; report medians/quantiles.
- Unit traps: °C is interval (no true zero) → ratios like “30°C is 2× 15°C” are invalid; Kelvin is ratio.
-
Implicit missingness: “0” might mean “unknown”; encode
NaN/NAexplicitly. - Re-encoding danger: integer-coding categories does not make them numeric.
| Concept | pandas dtype / tool | Note |
|---|---|---|
| Nominal |
category / string
|
Memory-friendly categories. |
| Ordinal | CategoricalDtype(ordered=True) |
Define order explicitly. |
| Interval |
float64, datetime64[ns]
|
Beware time zones. |
| Ratio |
int64 / float64
|
Keep units in column name. |
| Binary | bool |
Encode missing as pd.BooleanDtype(). |
| Datetime |
to_datetime, dt accessor |
Store as UTC internally. |
| Geo |
geopandas.GeoDataFrame (geometry) |
Track CRS; don’t mix. |
- Name each column’s scale (nominal/ordinal/interval/ratio).
- Set dtype accordingly (categories ordered where needed).
- Write the unit and missingness policy.
- Choose summaries & charts that the scale permits.
| Scale | Permitted comparisons / operations | Safe descriptive stats | Bad/misleading stats to avoid | Recommended plots |
|---|---|---|---|---|
| Nominal | equality / membership | counts, proportions, mode | mean, standard deviation, correlations | bar charts (counts / proportions), mosaic |
| Ordinal | order, ranking, percentiles | median, percentiles, rank‑based | mean on raw codes, linear regressions | ordered bar, box / violin by group (on ranks) |
| Interval | differences meaningful (no absolute zero) | mean, standard deviation, z‑scores | ratios (e.g. “twice as big”) | histogram, KDE, line plot |
| Ratio | full arithmetic ( + − × ÷ ) | mean, geometric mean (if >0), CV | (still avoid mixing types blindly) | histogram (possibly log scale), scatter |
Rule of thumb: If your data is non‑numeric or has arbitrary codes, treat as nominal/ordinal — don’t compute mean or Pearson correlations until it's truly interval/ratio.
Legend:
- 🔰 Start here
- 🏵️ Important Insight
- ⚙️ Technical and applications
- 💻 Some Code
- ⚜️ Advanced Topics
- 00.1 What Is Data?
-
00.2 Three Models of Reality (planned)
- 00.2.1 The Linguistic
- 00.2.2 The Symbolic
- 00.3.3 The Mathematical
- 00.3 Maps and Reality
- 00.4 Aside: Hossack, data as structure
- 00.5 Aside: Chomsky, data as evidence
- 01.1 🔰 Sets and Logic (planned)
- 01.2 Sample Space
- 01.3 Randomness and Pattern
- 01.4 Outcomes and Events
- 01.5 Finite and Infinite Sample Spaces
- 02.1 🔰 Functions (planned)
- 02.2 Types Are Alphabets
- 02.3 Random Variables: X : Ω → 𝒳 (planned)
- 02.4 Measurement Scales
- 02.5 Numerics
- 03.1 🔰 Fractions and Proportions (planned)
- 03.2 Randomness vs Uncertainty
- 03.3 Probability: Events, Conditioning, Bayes
- 03.4 Bayes' Theorem, Step by Step
- 03.5 Expected Value and Variance (planned)
- 03.6 Bernoulli (ES)
- 03.7 Discrete Uniform (ES)
- 03.8 🧗 Kolmogorov: Ω, 𝒜, ℙ
- 04.1 🔰 Powers and Logarithms (planned)
- 04.2 Rarity
- 04.3 Information Theory (Shannon)
- 04.4 Entropy: Three Views
- 05.1 🔰 Sums and Averages (planned)
- 05.2 Data, Measured
- 05.3 Sampling (ES)
- 05.4 Population and Sample (ES)
- 05.5 Types of Sampling (ES)
- 05.6 Choosing Summaries & Visuals
- 05.7 Visualization
- 05.8 Plots
- 06.1 What Is Statistics?
- 06.2 🔰 Curves and Area (planned)
- 06.3 Statistical Thinking
- 06.4 Variation
- 06.5 Uncertainty
- 06.6 Parameters vs Estimators (ES)
- 06.7 Distributions
- 06.8 Statistical Modeling
- 06.9 Statistical Methods
- 07.1 Data Storage: Databases (stub)
- 07.2 ER Diagrams
- 07.3 Chen Diagrams
- 07.4 SQL (planned)
- 07.5 Formal Languages and Regular Expressions (planned)
- 07.6 Reproducibility (planned)
08 · μ(x) — Fuzzy - When data is flexible
- 08.1 Fuzzy Logic (planned)
- 08.2 Fuzzy Numbers (planned)
- 08.3 Possibility vs Probability (planned)
09 · x(t) — Signals and systems - Where patterns live
- 09.1 Signals (stub)
- 09.2 Sampling and Aliasing (planned)
- 09.3 Convolution (planned)
- 09.4 Frequency (planned)
- 10.1 🔰 Vectors and Matrices (planned)
- 10.2 Mathematical Modelling (planned)
- 11.1 🔰 Derivatives (planned)
- 11.2 Convex Optimisation (planned)
- 12.1 Supervised Learning (planned)
- 12.2 Data in Language Models
- 13.1 Cause and Effect (planned)
- 13.2 Capstone Guide (planned)