Types of variables: categorical, ordinal and continuous

Analytika TeamLast reviewed 6 min read

Before you choose a test, draw a chart or calculate an average, you need to know what kind of variable each column is. It sounds basic, but it’s the step behind most “wrong test” mistakes. An average of country codes is meaningless, and a t-test on a yes/no outcome answers the wrong question.

The three types that matter for choosing a test

Categorical (nominal) variables

Values are labels for groups, with no natural order. You can count them, but you can’t rank or average them.

  • Examples: blood type, eye colour, country, treatment vs control, yes/no answers.
  • Summarise with counts and percentages, and show them in a bar chart.
  • A categorical variable with exactly two values (pass/fail, smoker/non-smoker) is called binary or dichotomous. It often gets its own methods, such as logistic regression.

Watch out for numeric codes. If 1 = urban, 2 = suburban and 3 = rural, the column looks numeric, but the variable is categorical. Software that sees numbers may happily give you a mean of 1.8, which means nothing.

Ordinal variables

Values are categories with a meaningful order, but the gaps between them aren’t known to be equal.

  • Examples: education level, a satisfaction rating from “very dissatisfied” to “very satisfied”, cancer stage, finishing position in a race.
  • Summarise with the median and range or interquartile range, plus frequencies for each level.
  • Rank-based tests such as Mann-Whitney and Spearman’s correlation are designed for ordinal outcomes.

A single Likert item is ordinal. A scale score built by summing or averaging several items is often treated as continuous. That’s a common, defensible practice, but it’s a choice you should state.

Continuous (quantitative) variables

Values are measured amounts where the difference between two values means the same thing anywhere on the scale. Going from 20 to 25 kg is the same change as going from 70 to 75 kg.

  • Examples: height, weight, age, income, test scores, reaction time, blood pressure.
  • Summarise with the mean and standard deviation, or the median and IQR if the data are skewed.
  • You can use t-tests, ANOVA, Pearson correlation and linear regression, provided their assumptions hold.

Strictly, “continuous” means any value is possible (1.73 m), while discrete counts (number of children, number of errors) can only be whole numbers. Counts with many possible values usually behave well enough to treat as continuous. Counts that are mostly zeros and small numbers are better handled with count models such as Poisson regression.

Quick reference

TypeOrder?Equal gaps?Typical summary
CategoricalNoNoCounts, percentages, mode
OrdinalYesNoMedian, IQR, frequencies
ContinuousYesYesMean and SD, or median and IQR

These three types map onto the four classic levels of measurement (nominal, ordinal, interval, ratio). Interval and ratio are both “continuous” for the purpose of choosing a test.

Independent and dependent variables

Variable type is a separate question from a variable’s role in your study. The dependent variable (outcome) is what you measure to see if it changes. The independent variable (predictor, or grouping variable) is what you think explains that change. Every role can have every type: a categorical predictor with a continuous outcome is a t-test or ANOVA, a continuous predictor with a binary outcome is logistic regression, and so on.

How the type decides the test

OutcomePredictorTypical test
ContinuousCategorical, 2 groupsIndependent t-test or Mann-Whitney
ContinuousCategorical, 3+ groupsOne-way ANOVA or Kruskal-Wallis
ContinuousContinuousCorrelation or linear regression
CategoricalCategoricalChi-square or Fisher’s exact test
BinaryAny mixLogistic regression
OrdinalCategoricalMann-Whitney, Kruskal-Wallis, or ordinal regression

This is also the first thing Analytika does with an uploaded file: it classifies every column’s type before it considers a test, and it checks the assumptions on your actual data before choosing. For the full decision path, see how to choose a statistical test.

More in Foundations

Try it with the free tools

Run this on your own data

Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.

Try it free