# What Is an Ordinal Variable? Definition and Examples

To define ordinal, start with the idea of order. An ordinal variable is a categorical variable whose categories have a meaningful, ranked order, but the gaps between those categories are not guaranteed to be equal. That single property separates ordinal variables from nominal variables, which have no order at all, and from interval variables, which have equal spacing between values.

## Quick Answer

- An ordinal variable has categories you can rank from low to high, such as Poor, Fair, Good, Excellent.
- The order is real and meaningful, so you can say one category is higher than another.
- The distances between categories are not assumed to be equal, so "Good minus Fair" has no fixed numeric size.
- You summarize ordinal data with counts, percentages, the median, and the mode, not with a mean.
- Ordinal sits between nominal (unordered categories) and interval (ordered categories with equal gaps) on the levels of measurement.

## What an Ordinal Variable Means

In plain terms, an ordinal variable is a label with a built-in ranking. If you can sort the categories from least to most without guessing, you are looking at an ordinal variable. Survey ratings, education levels, and satisfaction scores are everyday examples.

The precise statistical definition is narrower. An ordinal variable is a variable whose values fall into mutually exclusive and exhaustive categories that have a defined order, where the ordering is meaningful but the numerical distance between adjacent categories is unknown or unequal. Mutually exclusive means each case fits exactly one category. Exhaustive means the categories cover every possible response.

The word "ordinal" comes from the same root as "order." When people search for the meaning of ordinal, they usually want exactly this: a category that carries rank. The ordinal def in most statistics texts adds one more condition, which is that you cannot treat the category codes as real numbers with equal spacing.

A short example makes the difference clear. A variable for eye color (blue, brown, green) is nominal because no category is higher than another. A variable for shirt size (small, medium, large) is ordinal because the sizes rank in a clear order. A variable for temperature in degrees Fahrenheit is interval because the order is meaningful and the gaps are equal.

## How It Works

Ordinal variables work through a coding scheme. You assign a number to each category so the software can sort and summarize it, but the number is a rank label, not a measurement.

The core idea is a monotonic mapping from categories to codes:

$$
c_1 \prec c_2 \prec \dots \prec c_k \quad \Longleftrightarrow \quad x_1 < x_2 < \dots < x_k
$$

Here is what each symbol means.

- $c_1, c_2, \dots, c_k$ are the ordered categories, from lowest to highest.
- $\prec$ means "ranks below."
- $x_1, x_2, \dots, x_k$ are the numeric codes you assign, such as 1, 2, 3, 4.
- $k$ is the number of categories.

The mapping only preserves order. It does not preserve distance. Coding Poor, Fair, Good, Excellent as 1, 2, 3, 4 keeps the ranking intact, but it does not claim the jump from Poor to Fair equals the jump from Good to Excellent.

Because of this, the valid summary statistics are the ones that depend on order alone. The median is the middle category once you sort the data. The mode is the most frequent category. Counts and percentages describe how responses spread across categories. The mean and standard deviation assume equal spacing, so they are usually inappropriate unless you have evidence the spacing is equal.

## Worked Example

A survey asked 12 customers to rate their satisfaction on an ordinal scale with four ordered categories.

| customer_id | rating |
|---|---|
| 1 | Poor |
| 2 | Fair |
| 3 | Good |
| 4 | Excellent |
| 5 | Good |
| 6 | Fair |
| 7 | Good |
| 8 | Excellent |
| 9 | Fair |
| 10 | Good |
| 11 | Good |
| 12 | Fair |

Step 1. Set the ordered categories from low to high: Poor=1, Fair=2, Good=3, Excellent=4.

Step 2. Count responses per category: Poor: 1, Fair: 4, Good: 5, Excellent: 2. The total is n = 12.

Step 3. Convert ratings to numeric codes: [1, 2, 3, 4, 3, 2, 3, 4, 2, 3, 3, 2].

Step 4. Sort the codes: [1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4].

Step 5. Find the median position with (n+1)/2 = (12+1)/2 = 6.5.

Step 6. Average positions 6 and 7: (3 + 3)/2 = 3.0. The median code is 3, which maps to the category Good.

Step 7. The mode is Good, appearing 5 times.

You can reproduce this in Python by treating the rating as an ordered categorical.

```python
import pandas as pd
df = pd.DataFrame({'rating': ['Poor', 'Fair', 'Good', 'Excellent', 'Good', 'Fair', 'Good', 'Excellent', 'Fair', 'Good', 'Good', 'Fair']})
order = ['Poor','Fair','Good','Excellent']
df['rating'] = pd.Categorical(df['rating'], categories=order, ordered=True)
print(df['rating'].value_counts().reindex(order))
print('median:', df['rating'].sort_values().iloc[(len(df) - 1) // 2])
```

Output:

```text
Poor 1
Fair 4
Good 5
Excellent 2
median: Good
```

The median lands on Good, and the mode is also Good. Notice that the median comes from sorting by the category order, not from averaging raw scores. pandas does not support `.median()` on a categorical column, so the code takes the middle value of the sorted ratings. This is the correct treatment for an ordinal variable.

## How to Interpret It

Interpret an ordinal variable by reading the rank, not the number. When the median category is Good, the statement is that half the responses fall at or below Good and half at or above it. That is a positional claim, not a claim about an average score.

Report the distribution first. Counts and percentages across categories tell you where responses cluster. In the example, 5 of 12 responses are Good, which is the largest single group. The mode captures that peak.

Use the median when you want a single summary of the middle. Use the mode when you want the most common category. Use the full distribution when the shape matters, because two datasets can share a median and still look very different.

Be careful with any statement that implies equal spacing. Saying "the average rating is 2.75" treats the codes as interval numbers and assumes the gaps are equal. Unless you have evidence for that, the claim is unsupported. For more on how these categories relate, see nominal vs ordinal variables.

## When to Use It (and when not to)

Use an ordinal variable when the categories have a natural order and you want to preserve that order in your analysis. Common cases include satisfaction ratings, education levels, agreement scales, and severity grades. Ordinal logistic regression is built for exactly this kind of outcome, and it models the probability of falling into higher categories [1].

Do not force an ordinal variable into interval methods. If you compute a mean and standard deviation on rank codes, you are assuming equal spacing that the data may not support. If the spacing is genuinely equal and you can justify it, the variable behaves more like an interval variable, and you can treat it that way.

Do not collapse an ordinal variable into two groups without thinking it through. Turning a five-level scale into "satisfied" and "not satisfied" throws away the ranking information. One study compared binary and ordinal definitions of continence outcomes and found that the ordinal treatment preserved more detail than the binary classification [1]. If your question is about degree, keep the ordinal structure.

## Ordinal vs Nominal

The closest related idea is the nominal variable. Both are categorical, so both use labels instead of measured quantities. The difference is order.

| Feature | Ordinal variable | Nominal variable |
|---|---|---|
| Categories | Labels with a rank | Labels with no rank |
| Order | Meaningful | Not meaningful |
| Example | Poor, Fair, Good, Excellent | Red, Blue, Green |
| Valid center | Median, mode | Mode only |
| Numeric codes | Rank labels | Identity labels |

With an ordinal variable, you can say Good is higher than Fair. With a nominal variable, you cannot say blue is higher than red. That is the whole distinction. If you want a deeper comparison, read what is a nominal variable.

## Common Mistakes

- Treating rank codes as real numbers. Coding Poor to Excellent as 1 to 4 does not make the gaps equal. Fix: report the median and mode, and only compute a mean if you can justify equal spacing.
- Averaging ordinal categories directly. A mean of 2.75 on a four-point scale is hard to interpret. Fix: describe the distribution with counts and percentages.
- Assuming every ordered label is ordinal. Some labels look ordered but are not ranked by respondents. Fix: confirm that the order is meaningful to the people who answered.
- Dropping the order when coding. If you store categories as plain text without an order, software may sort them alphabetically. Fix: declare the category order explicitly, as the example does.
- Collapsing categories too early. Merging levels into two groups discards ranking detail. Fix: keep the full scale unless your question requires a binary outcome.
- Using a nominal test on ordinal data. A chi-square test ignores order. Fix: use a test that respects rank, such as an ordinal logistic model [1].

## Limitations

An ordinal variable cannot tell you the size of the difference between categories. You know Good ranks above Fair, but you do not know by how much. This limits any analysis that depends on distance, including means, standard deviations, and correlation coefficients that assume interval spacing.

Ordinal coding also depends on the assumption that respondents share the same understanding of the order. If one person reads "Fair" as barely acceptable and another reads it as nearly good, the ranking is consistent but the meaning drifts. This is a measurement limitation, not a math error, and it is why ordinal results are best reported as distributions and ranks.

## Frequently Asked Questions

### What is the definition of ordinal in simple terms?

An ordinal variable is a category with a clear order, such as low, medium, and high. You can rank the categories, but you cannot assume the steps between them are equal. That is the short definition of ordinal.

### Is age an ordinal variable?

Age measured in years is a ratio variable, not ordinal, because the values are real numbers with equal spacing and a true zero. Age grouped into bands like 18 to 24 and 25 to 34 is ordinal, because the bands have order but the gaps are not equal units.

### Can you calculate a mean for ordinal data?

You can compute a mean on the numeric codes, but interpreting it is risky. The mean assumes equal spacing between categories, which ordinal data does not guarantee. The median and mode are safer summaries. See what is ordinal data for more on summarizing these variables.

### What is the difference between ordinal and interval data?

Ordinal data has order but unequal or unknown gaps. Interval data has order and equal gaps, so differences are meaningful. Temperature in degrees Celsius is interval. A satisfaction rating is ordinal. The levels of measurement guide covers all four types.

### How do I know if my variable is ordinal?

Ask two questions. Can you rank the categories from low to high? Are the gaps between categories unequal or unknown? If the answer to both is yes, the variable is ordinal. If the gaps are equal, it is interval. If there is no order, it is nominal.

## References

1. [Kelly MS, Liu T, Routh JC, Castillo H, Tanaka ST, Smith K, Krach LE, Zhang A, Sh (2024). Comparing binary &amp; ordinal definitions of urinary &amp; stool continence outcomes: Data from the National Spina Bifida Patient Registry. Journal of pediatric urology](https://pubmed.ncbi.nlm.nih.gov/38368164/)
2. [Scholars@Duke publication: Ordinal efficiency and dominated sets of assignments](https://scholars.duke.edu/publication/756537)

## Further Reading

- [NIST/SEMATECH e-Handbook of Statistical Methods](https://www.itl.nist.gov/div898/handbook/index.htm)
- [OpenStax. Introductory Statistics 2e](https://openstax.org/details/books/introductory-statistics-2e)
- [Krzywinski M, Altman N (2013). Importance of being uncertain. Nature Methods](https://doi.org/10.1038/nmeth.2613)
- [Krzywinski M, Altman N (2013). Significance, P values and t-tests. Nature Methods](https://doi.org/10.1038/nmeth.2698)

## Related Articles

- [What Is an Ordinal Scale? Definition and Examples](/blog/data-analysis/ordinal-scale-definition-examples)
- [What Is Ordinal Data? Definition and Examples](/blog/data-analysis/what-is-ordinal-data-examples)
- [Nominal vs Ordinal Variables: Differences and Examples](/blog/data-analysis/nominal-vs-ordinal-variables)
- [Levels of Measurement: Nominal, Ordinal, Interval and Ratio](/blog/data-analysis/levels-of-measurement-nominal-ordinal-interval-ratio)
- [What Is an Independent Variable? Definition and Examples](/blog/data-analysis/what-is-an-independent-variable)