By the end of this lesson, you should be able to
- Distinguish categorical and quantitative variables.
- Recognize different measurement scales and their limitations.
- Explain why collection methods matter as much as calculations.
We are going to do something statisticians are surprisingly prone to neglect: ask what the numbers mean before doing mathematics with them.
Suppose a hospital records a patient’s temperature as 39. Is the patient feverish? We cannot answer without knowing whether that number means degrees Celsius or Fahrenheit. And that is a relatively simple measurement problem.
A dataset is a collection of observations about units: people, events, places, machines, or anything else we can observe. A variable is an attribute measured for each unit. One person can contribute multiple variables, such as age, reported study hours, and preferred transportation.
Names are not numbers
A categorical variable puts observations into groups. A student’s major or preferred musical genre is categorical. We can count categories and calculate their proportions. Averaging majors, however, makes no sense.
A quantitative variable records numerical amounts or counts. Distance traveled, number of books read, and exam scores are quantitative.
Quantitative variables are often described as discrete (counts such as number of siblings) or continuous (measurements such as temperature, which can in principle take values across an interval). The distinction depends partly on the measurement process: a thermometer might report tenths of a degree even though temperature itself varies continuously.
Measurement scales constrain conclusions
Four names are often useful:
- Nominal: categories without an inherent ordering, such as blood type.
- Ordinal: ordered categories, such as poor, fair, good, and excellent.
- Interval: numerical differences are meaningful, but zero is not an absence of the quantity, such as temperature in Celsius.
- Ratio: differences and ratios are meaningful and zero represents an absence, such as mass.
If a respondent gives a service a rating of 4 rather than 2, we can say the rating is higher. We cannot automatically conclude the respondent liked it twice as much. The numbers might label an ordinal scale rather than measure a ratio.
Where did these data come from?
Suppose a school’s website asks visitors whether students should have longer holidays. Ten thousand people respond. That is a lot of observations, but it is not necessarily a useful estimate of what the school’s students think.
The visitors were not randomly selected from the students. They might not even be students.
This is called selection bias: the mechanism that puts people in our dataset is related to what we want to measure.
Other problems include missing responses, ambiguous questions, miscalibrated instruments, and variables that are convenient to collect but poorly represent the underlying concept.
An easy mistake: treating codes as quantities
Consider the table:
| Student | Major code | Study hours |
|---|---|---|
| A | 1 | 5 |
| B | 3 | 8 |
| C | 2 | 4 |
The mean study time is hours. The mean major code, 2, is arithmetically calculable but conceptually meaningless. Those codes are labels.
A valid operation on numbers is not necessarily a valid operation on data.
Check your understanding
- Is a ZIP code categorical or quantitative, even though it contains digits?
- What additional information would you need to interpret a recorded temperature of 39?
- Why might a voluntary online poll of 100,000 people be less informative than a carefully selected survey of 1,000?
Suggested responses
- Categorical: the digits identify a location rather than measuring a quantity. 2. At minimum, the temperature scale and what was measured. 3. Sample selection matters; very large nonrepresentative samples can preserve systematic bias.
Turning a question into a defensible measurement
Suppose we ask whether tutoring improves statistics performance. Before surveying anyone, we have to choose what that means. Is it a final exam score, an independently marked common assessment, a course grade, passing the module, or confidence answering questions? Those are related but different constructs. Asking students how much they feel they learned does not directly measure their demonstrated proficiency.
Write a miniature data dictionary before collecting data:
| Variable | Meaning | Type | Measurement problem |
|---|---|---|---|
| Workshop offered | Randomized offer of workshop access | Binary category | Did everyone receive the assigned offer? |
| Workshop attended | Actual participation | Binary category | Partial attendance may be lost |
| Prior preparation | Pre-workshop knowledge assessment | Quantitative score | Was the assessment consistent and appropriate? |
| Later performance | Result on the agreed outcome measure | Quantitative score | Was grading comparable or blinded? |
| Missing outcome | Whether the result was actually observed | Binary category | Does absence depend on the outcome? |
Notice that offered and attended are different variables. If someone receives an invitation but does not attend, including them according to their randomized offer answers a different question from analyzing only people who chose to participate.
The data dictionary is not administrative decoration. It determines whether the analysis can answer the question. You will use these definitions in the Week 1 study-design studio.
The unit of observation controls the denominator
Imagine a clinic file with one row per visit. A person attending five times supplies five rows. The mean waiting time across visits targets a visit-level average; the mean of each person’s average targets a person-level quantity. If frequent visitors have different waits, the two summaries can differ even when every row is accurate. Define whether the unit is a person, visit, household, or measurement before computing a sample size.
Derived variables need operational definitions. Body mass index uses mass in kilograms divided by squared height in metres. Supplying height in centimetres without converting changes the numerical result by a factor of 10,000. A data dictionary should record units, coding, valid ranges, timing, missing-value codes, and transformations. Plausibility checks require subject-matter limits, not just a column’s software type.
Ordinal codes preserve order but not necessarily equal spacing. A shift from category 1 to 2 on a satisfaction scale need not equal a shift from 4 to 5. Means of such codes can be used under an explicitly defended measurement model, but the numeric labels alone do not establish that model. Report category distributions when the spacing assumption is uncertain.
Further practice
- A file has 500 visits from 120 people. Which number is the count of independent people?
- Is a postal code a quantitative variable because software stores it as an integer?
- Specify a data-dictionary entry for travel time that makes its units and missingness unambiguous.
Worked further responses
- There are 120 distinct people; whether they are independent still depends on recruitment and relationships. The 500 rows are visits, not 500 independent people.
- No. It is a category identifier; arithmetic differences generally lack a measured-distance meaning.
- For example: elapsed door-to-door minutes, measured on a designated day, nonnegative numeric values, missing represented as an explicit missing value, with zero reserved for a genuine zero-duration journey if that is allowed.
Keep your place
Mark this lesson complete after you've read it, attempted its exercises, and explained its central idea in your own words.
Progress is not saved unless you choose to mark the lesson complete.
Saved only in this browser's local storage. No required account, server transmission, or analytics. You can reset your saved progress on the course page. Clearing browser data also clears the record.