Key Points
- Numerical means numbers you can add and average. Discrete: whole numbers, like kids in a family. Continuous: any value in a range, like time or weight.
- Categorical means labels. Nominal: no natural order, like eye color. Ordinal: order but uneven gaps, like small, medium, large.
- Binary is a category with exactly two values: yes/no, true/false.
- Text, images, time series are other common types. Each needs its own handling.
- The type decides which summary stats, charts, and models actually make sense.
What it is
Data comes in different flavors. The big split: numbers versus categories. Numbers you can do math on. Categories are labels, like 'red', 'blue', or 'apple'. Within numbers, there's continuous (height, temperature) and discrete (number of kids). Within categories, there's nominal (no order: colors, countries) and ordinal (has order: movie ratings, education level). Pick the wrong analysis for the wrong type, and you'll get nonsense.
Why it exists
If you treat a category like a number, say encode 'red' as 1 and 'blue' as 2, then take the average, you get total nonsense. 'Average color' doesn't mean anything. Data types exist to stop you from doing stuff that makes no logical sense.
Intuition
Example
Customer survey: Age (numerical continuous), Number of purchases (numerical discrete), Country (categorical nominal), Satisfaction (1=Very unhappy, 2=Neutral, 3=Happy, which is categorical ordinal).
You can average age and purchases. You can't average country. For satisfaction, you can say 'the median is 2', but don't say 'the average is 2.3'. The gap between 1 and 2 might not mean the same as between 2 and 3.
When to use
- Before any analysis, check the type of each variable. It tells you your next move.
- Use bar charts and mode for categories. Use histograms and mean or median for numbers.
- For ordinal data, medians and percentiles are usually safer than means.
Common mistakes
- Turning categories into numbers, like 1=red, 2=blue, and feeding them into a model as if they were numerical. The model will think 2 is twice 'redness' of 1.
- Using mean for ordinal data. 'Average satisfaction of 2.3' is meaningless if the scale isn't evenly spaced.
- Calling discrete data 'continuous'. Treat counts appropriately.
Notes
- In machine learning, you have to encode categories, using one hot or label encoding, before feeding them into most algorithms. The choice matters a lot.
Was this concept helpful?
Related concepts