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:

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:

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:

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:

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:

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:

  1. nominal;
  2. ordinal;
  3. interval;
  4. 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:

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

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:

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:

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.

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:

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.

Classification belongs to the recorded variable, not merely to the general subject matter.

Binary Variables

A binary variable has exactly two categories.

Examples include:

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:

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:

Those versions can have different mathematical structures.

A Reliable Classification Procedure

  1. Identify what one recorded value represents.
  2. Ask whether the value is a label/category or a numerical amount.
  3. If quantitative, ask whether the possible values are discrete or continuous.
  4. Ask whether categories have a meaningful order.
  5. If numerical differences are meaningful, ask whether equal differences represent equal changes.
  6. Ask whether zero represents a genuine absence of the measured quantity.
  7. 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:

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.

  1. favorite music genre;
  2. number of books owned;
  3. commute distance;
  4. postal code.

Practice 2: Discrete or Continuous

Classify each quantitative variable as discrete or continuous.

  1. number of support tickets received;
  2. time required to resolve a ticket;
  3. number of defective units;
  4. mass of a shipment.

Practice 3: Nominal or Ordinal

Identify the measurement level.

  1. shirt color;
  2. customer priority: low, medium, high;
  3. country of residence;
  4. race finishing position.

Practice 4: Interval or Ratio

Identify the measurement level.

  1. temperature in degrees Celsius;
  2. elapsed travel time;
  3. distance from a warehouse;
  4. 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?

  1. mass in kilograms;
  2. temperature in degrees Fahrenheit;
  3. number of website visits;
  4. elapsed time in seconds.

Practice 8: Same Topic, Different Recording

Age is recorded in two different datasets.

  1. Dataset A records exact age in years.
  2. 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:

Give the broad type and measurement level for each.

Practice Answers

Practice 1

  1. favorite music genre: categorical;
  2. number of books owned: quantitative;
  3. commute distance: quantitative;
  4. postal code: categorical identifier.

Practice 2

  1. support tickets: discrete;
  2. resolution time: continuous;
  3. defective units: discrete;
  4. shipment mass: continuous.

Practice 3

  1. shirt color: nominal;
  2. customer priority: ordinal;
  3. country of residence: nominal;
  4. race finishing position: ordinal.

Practice 4

  1. Celsius temperature: interval;
  2. elapsed travel time: ratio;
  3. distance from a warehouse: ratio;
  4. 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

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.