The Language of Variation: Variables
| English | Chinese | Pinyin |
|---|---|---|
| categorical | 分类 | fēn lèi |
| quantitative | 定量 | dìng liàng |
| Discrete | 离散 | lí sàn |
| Continuous | 连续 | lián xù |
Not all variables are the same
- Before you graph or summarize data, you must know what kind of variable you have.
- The big split: categorical 分类 (labels/groups) vs. quantitative 定量 (numbers you can do arithmetic on).
- The type decides which graphs and which summaries make sense.
- Choosing the wrong tool for the type is a classic mistake — so classify first.
Categorical vs. quantitative
- A categorical variable records a group or label: eye color, favorite sport, yes/no.
- A quantitative variable is a measured number you can average: height, age, test score.
- Quick test: does averaging the values make sense? If yes → quantitative; if no → categorical.
- (Zip codes look numeric but are categorical — you'd never average them.)
Categorical or quantitative?
Decide whether each variable is a label (categorical) or a number you can average (quantitative).
Eye color is a ____ variable.
It records a label/group → categorical.
A quick test: a variable is quantitative if taking its ____ makes sense.
Averaging works for numbers, not labels.
Discrete vs. continuous
- Quantitative variables come in two flavors.
- Discrete 离散 variables take countable, separate values (number of siblings: $0,1,2,\dots$).
- Continuous 连续 variables can take any value in a range (height: $170.3$ cm, $170.34$ cm, …).
- Counting → discrete; measuring → usually continuous.
Number of pets is a quantitative variable that is...
A count takes separate whole values → discrete.
Height measured in cm is quantitative and...
It can take any value in a range → continuous.
Type dictates the tools
- Categorical → bar charts, pie charts, frequency tables, proportions.
- Quantitative → histograms, dotplots, boxplots, mean, standard deviation.
- Using a quantitative tool (like a mean) on a categorical variable is meaningless.
- So always classify the variable before picking a graph or summary.
A zip code, though written with digits, is a categorical variable.
Averaging zip codes is meaningless → categorical.
Which graphs suit a categorical variable?
Bar/pie for categorical; histogram/boxplot for quantitative.
Numbers aren't always quantitative. A variable coded with numbers (zip code, jersey number, a $1$–$5$ "strongly agree" scale used as labels) can still be categorical if averaging it is meaningless. Ask: "Does arithmetic make sense here?" That, not the appearance, decides the type.
Classify each variable for a group of students.
- Favorite subject: labels → categorical.
- Number of siblings: a count → quantitative, discrete.
- Height (cm): a measurement → quantitative, continuous.
Classify a variable as categorical (labels/groups) or quantitative (numbers you can average). Quantitative splits into discrete (countable) and continuous (any value in a range). The type decides which graphs and summaries are valid — and numbers used as labels are still categorical.