Not all data are alike, and treating them as if they were is the source of some of the most embarrassing mistakes in data analysis: computing the "mean" of a postal code, sorting provinces alphabetically and calling it a "ranking", or adding up satisfaction ratings as if they were euros. In this lesson you will learn to classify variables (qualitative and quantitative, with their subtypes), to recognize the four levels of measurement and the operations each one allows, to distinguish cross-sectional from longitudinal data, and to assess the quality of a dataset before analyzing it. We will work with two very concrete pieces of NovaMarket material: a purchase receipt and a Club Nova member record.

Contents

  1. The working material: a receipt and a member record
  2. Qualitative and quantitative variables
  3. The four levels of measurement
  4. Which operations each level allows
  5. Cross-sectional and longitudinal data
  6. Data quality: missing values, errors and duplicates

The working material: a receipt and a member record

Marta has asked you to document the data the team works with, starting with the two most heavily used tables. Remember from the previous lesson: each row is an observation and each column a variable. Today we focus on the columns.

Receipts table (unit of analysis: the transaction):

Receipt ID Date Store Channel No. of items Amount (€) Payment method Coupon used?
T-881204 2026-08-20 Valencia-Ruzafa In-store 14 47.85 Card Yes
T-881205 2026-08-20 Online Online 32 96.10 Card No
T-881206 2026-08-20 Bilbao-Casco In-store 3 8.95 Cash No

Club Nova member record (unit of analysis: the member):

Member ID Postal code Join date Age Spend tier Satisfaction (0-10) No. of children Usual store
S-1041 46006 2021-03-12 38 High 8 2 Valencia-Ruzafa
S-2233 08025 2023-11-02 55 Medium 6 0 Barcelona-Gràcia
S-0512 28010 2019-06-30 42 Low 9 1 Madrid-Chamberí

At first glance, almost everything is "numbers or text". But for statistics, what matters is not the format but what each variable represents and what it makes sense to do with it. Let's classify them.

Qualitative and quantitative variables

The first major division:

  • Qualitative (or categorical) variables: they express a quality or category, not an amount. They answer "what kind?". Examples: payment method, store, channel.
  • Quantitative (or numerical) variables: they express a measurable amount. They answer "how much?" or "how many?". Examples: amount, number of items, age.

Beware: being written in digits does not make something quantitative. The postal code 46006 is a number, but it measures no quantity: it is a label for an area. The definitive test is to ask yourself: would a mean of this variable make any sense? The "mean postal code" of your members (say, 27,347) means absolutely nothing.

Subtypes of qualitative variables

  • Nominal: categories with no natural order. Payment method (card, cash, mobile), usual store, channel (in-store/online). No category is "more" than another.
  • Ordinal: categories with a natural order, but where the distances between them are not measurable. The spend tier (Low < Medium < High) has a clear order, but is the distance between Low and Medium equal to the distance between Medium and High? We do not know; all we can do is rank.

A special case: dichotomous or binary variables (two categories), such as "Coupon used?" (Yes/No). They are nominal, and they will appear constantly throughout the course (in Module 4 you will see they have their own probability distribution, the binomial).

Subtypes of quantitative variables

  • Discrete: they take countable values, usually whole numbers, with "gaps" between possible values. Number of items on the receipt (3, 4, 5... never 3.7), number of children.
  • Continuous: in theory, they can take any value within an interval; between any two values there is always room for another. The receipt amount (€47.85), the delivery time (21.53 hours), the weight of the fruit sold.

A practical nuance: the amount in euros is recorded to two decimal places, yet it is treated as continuous because it measures a magnitude (money) that flows in a practically continuous way. The discrete/continuous boundary is sometimes a modeling decision rather than an absolute property.

Full classification of our variables

Variable Table Type Subtype
Store / Usual store Both Qualitative Nominal
Channel Receipts Qualitative Nominal (binary)
Payment method Receipts Qualitative Nominal
Coupon used? Receipts Qualitative Nominal (binary)
Postal code Members Qualitative Nominal (even though it looks numeric!)
Spend tier Members Qualitative Ordinal
Satisfaction (0-10) Members Qualitative ordinal (often treated as quantitative; see below) Ordinal
No. of items Receipts Quantitative Discrete
No. of children Members Quantitative Discrete
Amount (€) Receipts Quantitative Continuous
Age Members Quantitative Continuous (recorded in completed years)
Date / Join date Both Quantitative, interval (see levels of measurement) —

The four levels of measurement

The qualitative/quantitative classification is refined by the levels of measurement proposed by Stevens, which pin down precisely which mathematical operations are legitimate.

  1. Nominal level: only allows saying whether two values are equal or different. There is no order. Example: payment method.
  2. Ordinal level: besides equality, it allows ranking (greater/less), but the differences between values are not interpretable. Example: the Low/Medium/High spend tier.
  3. Interval level: besides ranking, the differences between values are interpretable and constant, but there is no absolute zero (the zero is conventional), so ratios are meaningless. Examples: the temperature in °C of NovaMarket's cold rooms (0 °C is not "absence of temperature"; 20 °C is not "twice as hot" as 10 °C) or dates (year 0 is a convention; the year 2000 is not "twice" the year 1000).
  4. Ratio level: like the interval level, but with an absolute zero that means "absence of the magnitude". Here ratios do make sense: a €60 transaction is twice a €30 one. Examples: amount, number of items, delivery time, age.

The case of the 0-10 satisfaction score

Strictly speaking, a satisfaction rating is ordinal: there is no guarantee that the distance between a 6 and a 7 equals the distance between a 9 and a 10 in the customer's mind. In business practice, however, it is common to treat it as if it were interval data (computing mean satisfaction scores), and with many responses this usually works reasonably well. What matters is that you know it is a practical convention, that it should be accompanied by the distribution of responses (how many 0-6s, how many 7-8s, how many 9-10s), and that there are methods designed specifically for ordinal data (the non-parametric methods covered in Module 7).

Which operations each level allows

This table is one of the most useful in the course; come back to it whenever you are in doubt:

Operation Nominal Ordinal Interval Ratio
Counting frequencies and computing percentages Yes Yes Yes Yes
Mode (most frequent value) Yes Yes Yes Yes
Ranking, median, percentiles No Yes Yes Yes
Adding/subtracting, mean, standard deviation No No* Yes Yes
Ratios ("twice as much as") No No No Yes

* Except for the practical convention discussed above for Likert-type/satisfaction scales.

(The mean, the median, the mode and the standard deviation are studied in depth in Module 2; here you only need to know which variables each of them can be applied to.)

Worked example: what can I do with each variable?

Marta hands you these 6 receipts from the Bilbao-Casco store this morning and asks for "a summary of each column":

ID Payment method No. of items Amount (€)
T-1 Card 5 12.50
T-2 Cash 2 4.30
T-3 Card 8 25.00
T-4 Mobile 5 15.20
T-5 Card 1 2.10
T-6 Cash 9 31.90

Payment method (nominal). All we can do is count: Card 3 out of 6 (50%), Cash 2 out of 6 (33.3%), Mobile 1 out of 6 (16.7%). The mode is "Card". Computing a "mean of payment methods" makes no sense.

Number of items (ratio, discrete). Everything is allowed. For instance, the mean:

\[ \bar{x} = \frac{5 + 2 + 8 + 5 + 1 + 9}{6} = \frac{30}{6} = 5 \text{ items} \]

And since it is on a ratio scale, ratios are valid: receipt T-6 (9 items) has three times as many items as T-2 (3 times 3... careful, let's check: \( 9/2 = 4.5 \), so it is 4.5 times the items of T-2 — always verify ratios before writing them in a report).

Amount (ratio, continuous). The mean:

\[ \bar{x} = \frac{12.50 + 4.30 + 25.00 + 15.20 + 2.10 + 31.90}{6} = \frac{91.00}{6} \approx 15.17 \text{ euros} \]

Ratio statements are also valid: "the largest receipt (€31.90) is about 15 times the smallest (€2.10)", because \( 31.90 / 2.10 \approx 15.2 \).

Cross-sectional and longitudinal data

Another key distinction is when the data are collected:

  • Cross-sectional data: many units are observed at a single point in time (or period). A snapshot. Example: the satisfaction of 1,200 members surveyed in September 2026, or yesterday's sales across the 42 stores.
  • Longitudinal data / time series: the same unit (or units) is observed over time. A movie. Example: the monthly sales of the Zaragoza store since 2020, or the quarterly spend of member S-1041 since joining.
Aspect Cross-sectional Longitudinal
Metaphor Photograph Movie
What varies The units (many rows = many units) Time (many rows = many points in time)
Typical NovaMarket question "Which stores are selling the most this month?" "How are each store's sales evolving?"
Typical risk Misses trends and seasonality Requires its own techniques (values close in time resemble each other)

Why does it matter? Because the methods in most of this course assume cross-sectional data (or independent observations). Data with a temporal structure — where December always spikes because of Christmas and each month "inherits" something from the previous one — need specific techniques, developed in the Time Series lesson of Module 7. For now it is enough that you can recognize which kind of data you are facing, because applying a simple mean to a strongly seasonal series can lead to misleading conclusions.

There is also a mixed format (panel data): many units followed over time, such as the monthly spend of all club members over three years. It is the richest structure — and also the most complex to analyze.

Data quality: missing values, errors and duplicates

Before analyzing anything, a professional inspects the data. Analysts are estimated to spend more time cleaning data than analyzing them, and for good reason: an impeccable analysis of dirty data produces dirty conclusions (garbage in, garbage out). The three classic problems:

Missing values

Empty cells, or cells flagged as unknown. In NovaMarket's member records, age is missing for many members (it is not required at sign-up). Questions you should ask yourself:

  • How many are missing? 2% of ages missing is barely a nuisance; 60% invalidates any analysis by age.
  • Are they missing at random, or with a pattern? This is the crucial one. If age is missing mostly for members who signed up through the website (where the field was optional), the members with a known age do not represent the whole: any "mean age of our members" will be biased towards the profile of people who sign up in-store.
  • What do I do with them? Options range from excluding those rows (acceptable if they are few and missing at random) to more advanced imputation techniques. What is unacceptable is not looking.

Recording errors

Values that are present but wrong. Real examples from NovaMarket's day-to-day:

  • An age of 142 years (a typing error: probably 42).
  • A receipt for −€35.80 (a legitimate refund or an error? You need to find out before deciding whether to exclude it).
  • A join date of 2062-03-12 (an impossible year: a transposition of 2026).
  • The same store written three different ways: "Valencia-Ruzafa", "valencia ruzafa", "VLC-Ruzafa" — to the computer these are three different stores, and your per-store counts will end up fragmented.

The practical defense: define validation rules (age between 18 and 105, amounts between −€500 and €3,000, no future dates, a closed catalog of store names) and systematically review out-of-range values. Careful, though: an extreme value is not always an error — a €1,900 receipt may be a genuine purchase by a catering company. The technique for detecting and assessing outliers is studied in Module 2 (Measures of Position and Outliers); deciding whether something is an error or a legitimate data point usually requires investigating the case.

Duplicates

The same observation recorded twice. If a POS glitch sends receipt T-881204 twice, the day's sales will appear inflated. Duplicates are especially treacherous because each one looks like valid data; they can only be detected by comparing rows with each other (same ID, or same date-store-amount-time combination). Always verify that the identifier (receipt ID, member ID) really is unique before counting or adding anything.

A mini quality checklist

Before any analysis at NovaMarket (and at your real company), run through this list:

  1. Is each row's identifier unique? (duplicates)
  2. How many values are missing per column, and do they follow any pattern? (missing values)
  3. Are there values outside their logical range, or misspelled categories? (errors)
  4. Does the total match some independent source? (for example, the sum of receipts against the declared checkout totals)
  5. Is it documented what each column means and how it is collected? (data dictionary)

Common Mistakes and Tips

  • Treating a numeric variable that is really a label as quantitative. Postal codes, member IDs, product codes: if the mean means nothing, the variable is qualitative. Always ask yourself "does this measure an amount?".
  • Averaging ordinal data without thinking. The mean satisfaction score is a useful convention, but never average arbitrary ordinal codes (for example, Low=1, Medium=2, High=3, mean=2.4) and present the result as a precise measurement: the numbers 1-2-3 were your own choice.
  • Claiming ratios on interval scales. "Today it is twice as hot as yesterday" (20 °C vs 10 °C) is incorrect; with dates and temperatures only differences are valid.
  • Analyzing a time series as if it were a snapshot. Comparing mean sales for November-December against January-February "to see whether the store is improving" ignores Christmas seasonality.
  • Skipping the quality inspection. The cost of discovering duplicates after presenting the report to management is far greater than the twenty minutes the checklist takes beforehand.
  • Professional tip: create (or request) the data dictionary for every table you use: variable name, meaning, type, level of measurement, valid values and how it is collected. It is the cheapest, highest-return data quality tool there is.

Exercises

Exercise 1

Classify each variable in this table from NovaMarket's e-commerce delivery survey, stating: (a) qualitative or quantitative, (b) subtype (nominal/ordinal or discrete/continuous) and (c) level of measurement (nominal, ordinal, interval or ratio).

  1. Delivery province
  2. Delivery time in hours (for example, 26.4)
  3. Delivery rating: "Poor / Fair / Good / Excellent"
  4. Number of parcels in the order
  5. Temperature (°C) recorded inside the refrigerated truck
  6. Was there an incident? (Yes/No)

Exercise 2

State whether each claim is statistically legitimate given the variable's level of measurement, and correct the ones that are not:

  1. "Order P-201 (€60) cost twice as much as P-187 (€30)."
  2. "The freezer room is at −18 °C today and was at −9 °C yesterday: it is twice as cold."
  3. "The mean postal code of our Valencia members is 46,021."
  4. "The median delivery rating was 'Good'."

Exercise 3

Marta sends you this extract from the members table for an urgent analysis. Identify all the quality problems you find and classify each one (missing value, recording error or duplicate):

Member ID Postal code Join date Age Usual store
S-4410 28010 2024-05-11 39 Madrid-Chamberí
S-4411 08025 2031-02-20 47 Barcelona-Gràcia
S-4412 46006 2022-09-03 Valencia-Ruzafa
S-4413 41013 2023-01-15 230 Sevilla-Nervión
S-4410 28010 2024-05-11 39 Madrid-Chamberí
S-4414 50006 2020-07-22 51 zaragoza centro

Solutions

Solution 1

  1. Province: qualitative nominal, nominal level.
  2. Delivery time: quantitative continuous, ratio level (0 hours means no waiting at all; 40 h really is twice 20 h).
  3. Poor/Fair/Good/Excellent rating: qualitative ordinal, ordinal level (there is an order, but the distances are not measurable).
  4. Number of parcels: quantitative discrete, ratio level.
  5. Temperature in °C: quantitative continuous, interval level (0 °C is conventional; ratios are invalid).
  6. Was there an incident?: qualitative nominal, binary, nominal level.

Common mistake: classifying temperature as ratio level. In °C the zero is not absolute (it would be in kelvin).

Solution 2

  1. Legitimate: the amount is on a ratio scale, so ratios are valid.
  2. Not legitimate: temperature in °C is interval data; all you can say is "it is 9 °C colder". ("Twice as cold" is not even well defined.)
  3. Not legitimate: the postal code is nominal; the mean means nothing. A possible correction: "the most frequent postal code (the mode) among our Valencia members is 46021".
  4. Legitimate: the median only requires an order, and an ordinal variable has one. (The mean, by contrast, would not be appropriate without additional conventions.)

Solution 3

  • S-4411, join date 2031-02-20: recording error (a future date; the current year is 2026).
  • S-4412, empty age: missing value.
  • S-4413, age 230: recording error (an impossible value; perhaps 23 or 30).
  • Fifth row (S-4410 repeated): an exact duplicate of the first row.
  • S-4414, "zaragoza centro": category recording error (format inconsistent with the catalog entry "Zaragoza-Centro"; it would fragment the per-store counts).

Common mistake: flagging the age of 230 as "an outlier to investigate". Legitimate outliers are extreme but possible values (a €1,900 receipt); an age of 230 years is impossible and is therefore an error, not an outlier.

Conclusion

You can now read a data table with a statistician's eyes: you distinguish qualitative variables (nominal and ordinal) from quantitative ones (discrete and continuous), you know the four levels of measurement and, above all, which operations each one allows — the criterion that will save you from averaging postal codes or doubling the "cold" of a freezer room. You can also tell the snapshot of cross-sectional data from the movie of longitudinal data, and you have a checklist for hunting down missing values, recording errors and duplicates before they contaminate a report. With the material classified and clean, one question remains that comes before all the others: where do data come from, and how do you make sure they represent the population well? That is the subject of the next lesson, Data Collection and Sampling, where you will help Marta design NovaMarket's annual satisfaction survey.

© Copyright 2026. All rights reserved