Statistics Data Types

Data falls into a small number of well-defined types, and knowing which type you are working with tells you which statistical summaries and charts are actually valid to use.

Two Big Families of Data

Every piece of data you collect is either numerical (a quantity you can do arithmetic with) or categorical (a label that sorts an observation into a group). Picking the right family matters, because a measure like the mean makes sense for numbers but is meaningless for labels like 'blue' or 'married'.

Numerical (Quantitative) Data

  • Discrete data can only take specific, countable values - usually whole numbers - such as the number of cars in a parking lot or the number of children in a family.
  • Continuous data can take any value within a range, including fractions and decimals, such as height, weight, temperature, or the time it takes to run a race.
ExampleValueDiscrete or Continuous
Number of pets owned2Discrete
Height of an adult172.5 cmContinuous
Number of emails received today14Discrete
Time to finish a 5K race24.83 minutesContinuous

Categorical (Qualitative) Data

  • Nominal data has categories with no natural order or ranking, such as eye color, blood type, or favorite programming language.
  • Ordinal data has categories that DO have a meaningful order, such as a satisfaction rating (poor, fair, good, excellent) or an education level (high school, bachelor's, master's, doctorate).

Example

observations = {
    "eye_color": "brown",       # nominal - categories, no order
    "satisfaction": "good",     # ordinal - categories, has order
    "num_pets": 2,               # discrete - countable whole number
    "height_cm": 172.5            # continuous - any value in a range
}

data_types = {
    "eye_color": "categorical (nominal)",
    "satisfaction": "categorical (ordinal)",
    "num_pets": "numerical (discrete)",
    "height_cm": "numerical (continuous)"
}

for key, value in observations.items():
    print(f"{key} = {value} -> {data_types[key]}")
Note: A common mistake is to average categorical data. It makes no sense to compute the 'mean eye color' of a classroom. For nominal data, the only central-tendency measure that makes sense is the mode (the most common category).

Matching Statistics to Data Types

Data TypeModeMedianMean / Std Dev / Variance
NominalYesNoNo
OrdinalYesYesNo
Discrete / Continuous numericalYesYesYes
Note: Watch out for numbers that are secretly categorical, like a zip code or a jersey number. They look numeric, but adding or averaging them produces meaningless results - they should be treated as nominal data.

Exercise: Statistics Data Types

Which data type includes categories with no meaningful order, such as eye color?