The Central Idea
A dataset is not merely a collection of values. Each value belongs to a variable, and each variable records some characteristic of the individuals, objects, events, or cases being studied.
The first question in data analysis is therefore:
What kind of information does this variable represent?
That classification controls what we are justified in doing with the data.
What Is Data?
Data are recorded observations, measurements, responses, counts, labels, or other values collected for analysis.
A small dataset might look like this:
| Student | Program | Credits | Exam Score |
|---|---|---|---|
| A | Biology | 12 | 88 |
| B | History | 15 | 91 |
| C | Biology | 9 | 76 |
The columns represent different variables, and those variables do not all have the same mathematical structure.
Cases and Variables
A case, sometimes called an observational unit, is one individual object or instance represented in the dataset.
A variable is a characteristic recorded for each case.
In the student table, each row is a case and the columns Program, Credits, and Exam Score are variables.
Two Broad Data Types
At an introductory level, variables are often divided into two broad classes:
- categorical variables, which place cases into groups or categories;
- quantitative variables, which record numerical amounts for which arithmetic has meaningful interpretation.
This distinction is more important than whether the recorded values happen to be written with digits.
Categorical Data
Categorical data identify groups, labels, qualities, or classifications.
Examples include:
- eye color;
- state of residence;
- academic major;
- payment method;
- product category;
- yes/no responses.
The categories may be written as words, symbols, or numerical codes.
Numerical Codes Can Still Be Categorical
Suppose a survey records
\[ 1=\text{cash},\qquad 2=\text{credit card},\qquad 3=\text{debit card}. \]The values \(1\), \(2\), and \(3\) are numbers, but they function only as labels.
Computing
\[ \frac{1+2+3}{3}=2 \]does not reveal an average payment method. The numerical appearance of a code does not automatically make it quantitative.
Quantitative Data
Quantitative data represent counts or measured amounts for which numerical differences, totals, or ratios may carry meaningful information.
Examples include:
- number of employees;
- distance traveled;
- annual revenue;
- height;
- waiting time;
- temperature.
Discrete Quantitative Variables
A discrete variable takes values from a set of separate, distinct possibilities.
Counts are commonly discrete.
For example, the number of customers arriving in one hour might be
\[ 0,1,2,3,\ldots \]A value such as \(4.6\) customers would not represent a possible count of individual customers.
Continuous Quantitative Variables
A continuous variable can, in principle, take any value within an interval of possible measurements.
Examples include:
- length;
- mass;
- time;
- volume;
- temperature measured on a continuous scale.
A measured value may be rounded in practice, but the underlying quantity can still be continuous.
Recorded Precision Does Not Determine the Underlying Type
Suppose heights are recorded to the nearest centimeter:
\[ 168,\qquad 172,\qquad 181. \]The recorded values look like whole numbers, but height is still ordinarily treated as a continuous variable because intermediate heights are possible.
The distinction concerns the quantity being measured, not merely the number of decimal places stored in the dataset.
Identifiers Are a Special Case
Some numerical variables are identifiers rather than quantities.
Examples include:
- student identification numbers;
- account numbers;
- telephone numbers;
- postal codes;
- product identification codes.
Their digits distinguish one case or category from another, but arithmetic on those digits is generally not meaningful.
Measurement Levels
A second classification describes how much mathematical structure is carried by the recorded values.
A common introductory framework uses four levels of measurement:
- nominal;
- ordinal;
- interval;
- ratio.
Each level supports certain kinds of comparison and calculation.
Nominal Level
Nominal data classify cases into categories without implying a natural ranking among those categories.
Examples include:
- blood type;
- country of manufacture;
- department name;
- vehicle color;
- browser type.
For nominal data, the principal meaningful comparison is whether two cases belong to the same category or to different categories.
Nominal Data Can Be Counted
Although arithmetic on category labels is usually meaningless, the frequencies of those categories are quantitative.
If a survey records
- 42 cash payments,
- 71 credit-card payments,
- 37 debit-card payments,
then the labels are nominal, while the counts \(42\), \(71\), and \(37\) are numerical summaries of those categories.
Ordinal Level
Ordinal data have categories with a meaningful order or ranking, but the size of the gap between categories is not assumed to be uniform.
Examples include:
- small, medium, large;
- bronze, silver, gold;
- first place, second place, third place;
- strongly disagree through strongly agree;
- low, medium, high priority.
Order Does Not Guarantee Equal Spacing
Suppose service quality is recorded as
\[ 1=\text{poor},\quad 2=\text{fair},\quad 3=\text{good},\quad 4=\text{excellent}. \]The numbers express order, but the framework does not guarantee that the difference from poor to fair is exactly the same size as the difference from good to excellent.
The codes preserve ranking without necessarily preserving equal numerical distances.
Interval Level
Interval data are numerical data for which equal differences represent equal amounts of change, but the zero point is not a true absence of the measured quantity.
A standard example is temperature measured in degrees Celsius or Fahrenheit.
The change from \(10^\circ\text{C}\) to \(20^\circ\text{C}\) is the same temperature difference as the change from \(20^\circ\text{C}\) to \(30^\circ\text{C}\):
\[ 20-10=30-20=10. \]Why Ratios Are Not Generally Meaningful for Interval Scales
On the Celsius scale, \(20^\circ\text{C}\) is not meaningfully described as "twice as hot" as \(10^\circ\text{C}\).
The scale's zero point is conventional rather than an absolute absence of thermal energy.
Interval scales support meaningful differences, but their ratios generally depend on where the zero point has been chosen.
Ratio Level
Ratio data have equal intervals and a meaningful zero representing the absence of the measured amount.
Examples include:
- mass;
- distance;
- elapsed time;
- sales revenue;
- number of defects;
- age measured as elapsed time since birth.
With ratio data, both differences and multiplicative comparisons can be meaningful.
Meaningful Ratios
Suppose two packages have masses of
\[ 5\text{ kg} \]and
\[ 10\text{ kg}. \]The second package has twice the mass of the first:
\[ \frac{10}{5}=2. \]This ratio is meaningful because \(0\text{ kg}\) represents zero mass on the measurement scale.
A Useful Hierarchy
The four levels are often introduced as an increasing hierarchy of structure:
\[ \text{nominal} \longrightarrow \text{ordinal} \longrightarrow \text{interval} \longrightarrow \text{ratio}. \]Moving to the right adds mathematical structure.
- Nominal: category identity.
- Ordinal: identity plus order.
- Interval: identity, order, and meaningful differences.
- Ratio: identity, order, meaningful differences, and a meaningful zero.
Summary Table of Measurement Levels
| Level | Categories? | Ordered? | Equal Differences? | Meaningful Zero? |
|---|---|---|---|---|
| Nominal | Yes | No | No | No |
| Ordinal | Yes | Yes | Not assumed | No |
| Interval | Numerical values | Yes | Yes | No |
| Ratio | Numerical values | Yes | Yes | Yes |
Data Type and Measurement Level Are Related but Different
The broad type and the measurement level answer different questions.
For example:
- eye color is categorical and nominal;
- class rank is categorical or rank-based and ordinal;
- Celsius temperature is quantitative and interval;
- distance is quantitative and ratio.
A complete description often gives both the broad type and the measurement level.
The Same Subject Can Be Recorded in Different Ways
The level of measurement depends on how a variable is defined and recorded.
Consider age.
- Exact age in years can be treated as quantitative ratio data.
- Age group such as child, adult, and older adult is categorical ordinal data.
- An identification code assigned to each participant is nominal even if it contains digits.
Classification belongs to the recorded variable, not merely to the general subject matter.
Binary Variables
A binary variable has exactly two categories.
Examples include:
- yes or no;
- pass or fail;
- present or absent;
- purchased or did not purchase.
Binary variables are often coded as \(0\) and \(1\), but they remain categorical when those numbers serve as category labels.
Ranks Are Not the Same as Measurements
Suppose three runners finish first, second, and third.
Their ranks are
\[ 1,\qquad 2,\qquad 3. \]These values describe order, not elapsed-time differences.
The first-place runner may have finished one second ahead of second place, while second place finished twenty seconds ahead of third place. Rank alone does not preserve those gaps.
Dates and Times Require Care
Calendar dates illustrate why classification requires attention to the scale being used.
Differences between dates can be meaningful:
\[ \text{September 10} - \text{September 1} = 9\text{ days}. \]But the calendar origin is conventional, so ratios of calendar dates are generally not meaningful.
Elapsed duration, by contrast, can have a meaningful zero and is commonly treated as ratio data.
Why Classification Matters
The data type influences which summaries and displays make sense.
For example:
- category counts and proportions are natural for nominal data;
- ordered categories can support medians and percentile-style reasoning;
- quantitative data can support numerical measures of center and spread;
- ratio data permit meaningful multiplicative comparisons when context supports them.
A calculation may be mechanically possible and still be conceptually inappropriate.
Meaningful Operations
One way to think about measurement levels is to ask which operations preserve interpretable information.
| Level | Typically Meaningful |
|---|---|
| Nominal | same/different, counts, proportions, mode |
| Ordinal | nominal comparisons plus order, ranks, medians, quantiles |
| Interval | ordinal comparisons plus differences and many arithmetic summaries |
| Ratio | interval operations plus ratios and multiplicative comparisons |
These are introductory guidelines. The appropriateness of a statistical method also depends on the study design, distribution, assumptions, and the question being asked.
Common Error: Treating Every Number as Quantitative
Suppose jersey numbers are
\[ 8,\qquad 14,\qquad 27. \]It is possible to compute their arithmetic mean, but the result does not describe an average player in a meaningful quantitative sense.
The numbers identify players. They are labels, so the variable is nominal.
Common Error: Assuming Ordered Codes Have Equal Gaps
A satisfaction scale may use
\[ 1,2,3,4,5. \]The coding establishes order, but it does not by itself prove that the psychological distance from \(1\) to \(2\) is identical to the distance from \(4\) to \(5\).
Do not infer equal spacing merely because consecutive integers were used as labels.
Common Error: Confusing Discrete with Ordinal
Discrete describes separated numerical possibilities.
Ordinal describes ordered categories or ranks.
These are different classifications.
The number of siblings is discrete quantitative data, while a rating of low, medium, or high is ordinal categorical data.
Common Error: Confusing Zero with a True Zero
The existence of a symbol \(0\) does not automatically create a ratio scale.
On the Celsius scale,
\[ 0^\circ\text{C} \]does not mean that temperature is absent.
A meaningful zero must correspond to the absence of the quantity measured, not merely to a chosen reference point.
Common Error: Ignoring Units and Definitions
A variable name by itself may not be enough to classify the data.
For example, "time" could mean:
- clock time;
- calendar date;
- elapsed duration;
- a coded shift such as morning, afternoon, or evening.
Those versions can have different mathematical structures.
A Reliable Classification Procedure
- Identify what one recorded value represents.
- Ask whether the value is a label/category or a numerical amount.
- If quantitative, ask whether the possible values are discrete or continuous.
- Ask whether categories have a meaningful order.
- If numerical differences are meaningful, ask whether equal differences represent equal changes.
- Ask whether zero represents a genuine absence of the measured quantity.
- State both the broad data type and measurement level when useful.
Example: Employee Dataset
Suppose a company records the following variables:
| Variable | Example | Broad Type | Measurement Level |
|---|---|---|---|
| Employee ID | 48317 | Categorical identifier | Nominal |
| Department | Finance | Categorical | Nominal |
| Performance band | High | Categorical | Ordinal |
| Years employed | 6.5 | Quantitative continuous | Ratio |
| Projects completed | 14 | Quantitative discrete | Ratio |
Example: Weather Dataset
Suppose a weather station records:
- weather condition: sunny, cloudy, rainy;
- temperature in degrees Celsius;
- rainfall amount in millimeters;
- number of lightning strikes.
A useful classification is:
| Variable | Type | Level |
|---|---|---|
| Weather condition | Categorical | Nominal |
| Celsius temperature | Quantitative continuous | Interval |
| Rainfall amount | Quantitative continuous | Ratio |
| Lightning strikes | Quantitative discrete | Ratio |
Practice 1: Identify the Broad Type
Classify each variable as categorical or quantitative.
- favorite music genre;
- number of books owned;
- commute distance;
- postal code.
Practice 2: Discrete or Continuous
Classify each quantitative variable as discrete or continuous.
- number of support tickets received;
- time required to resolve a ticket;
- number of defective units;
- mass of a shipment.
Practice 3: Nominal or Ordinal
Identify the measurement level.
- shirt color;
- customer priority: low, medium, high;
- country of residence;
- race finishing position.
Practice 4: Interval or Ratio
Identify the measurement level.
- temperature in degrees Celsius;
- elapsed travel time;
- distance from a warehouse;
- calendar year.
Practice 5: Numerical Codes
A survey codes marital status as
\[ 1=\text{single},\qquad 2=\text{married},\qquad 3=\text{other}. \]Is this variable categorical or quantitative? What is its measurement level?
Practice 6: Ordered Ratings
A customer survey uses the responses
\[ \text{poor},\quad \text{fair},\quad \text{good},\quad \text{excellent}. \]Identify the broad data type and measurement level.
Practice 7: Identify the True Zero
Which of the following ordinarily have a meaningful zero?
- mass in kilograms;
- temperature in degrees Fahrenheit;
- number of website visits;
- elapsed time in seconds.
Practice 8: Same Topic, Different Recording
Age is recorded in two different datasets.
- Dataset A records exact age in years.
- Dataset B records child, adult, or older adult.
Classify the two variables.
Practice 9: Identify the Error
A researcher averages the values
\[ 101,\qquad 205,\qquad 414 \]where those values are room numbers, and interprets the result as the "average room."
Explain the classification error.
Practice 10: Full Classification
A delivery company records the following variables:
- vehicle type;
- delivery priority: standard, expedited, urgent;
- number of packages;
- delivery distance in miles;
- temperature in degrees Celsius inside a refrigerated container.
Give the broad type and measurement level for each.
Practice Answers
Practice 1
- favorite music genre: categorical;
- number of books owned: quantitative;
- commute distance: quantitative;
- postal code: categorical identifier.
Practice 2
- support tickets: discrete;
- resolution time: continuous;
- defective units: discrete;
- shipment mass: continuous.
Practice 3
- shirt color: nominal;
- customer priority: ordinal;
- country of residence: nominal;
- race finishing position: ordinal.
Practice 4
- Celsius temperature: interval;
- elapsed travel time: ratio;
- distance from a warehouse: ratio;
- calendar year: interval-style scale for differences, not ratio comparisons.
Practice 5
The numbers are category labels, so the variable is categorical and nominal.
Practice 6
The responses are categorical and ordinal because they have a meaningful order without guaranteed equal spacing.
Practice 7
Mass, website-visit count, and elapsed time ordinarily have meaningful zeros. Fahrenheit temperature does not use zero to represent the absence of temperature.
Practice 8
Exact age in years is quantitative and ordinarily treated as ratio data. Age group is categorical ordinal data.
Practice 9
Room numbers are identifiers. They are nominal labels, so arithmetic on the codes does not produce a meaningful quantitative average.
Practice 10
| Variable | Broad Type | Measurement Level |
|---|---|---|
| Vehicle type | Categorical | Nominal |
| Delivery priority | Categorical | Ordinal |
| Number of packages | Quantitative discrete | Ratio |
| Delivery distance | Quantitative continuous | Ratio |
| Celsius temperature | Quantitative continuous | Interval |
What to Remember
- Data values must be interpreted through the variables they represent.
- Categorical variables describe groups or labels.
- Quantitative variables represent numerical amounts.
- Quantitative variables may be discrete or continuous.
- Nominal data provide categories without order.
- Ordinal data provide ordered categories without guaranteed equal spacing.
- Interval data support meaningful differences but lack a meaningful zero.
- Ratio data support meaningful differences and a meaningful zero.
- Numerical codes are not automatically quantitative.
- Always classify the recorded variable, not merely the topic it describes.
Where We Go Next
Data types tell us what kind of information has been recorded. The next step is to identify who or what the data describe and how observations are selected.
The next lesson, Populations, Samples, and Variables, introduces the distinction between an entire population and the sample observed from it, while developing the language used to describe cases and variables in a statistical study.