Durgical
EN
Open the app

Types of variables

  • Concept

Every piece of data has a type: unordered categories, ordered categories, counts or measurements. The type decides the summary and the test.

Updated

What it is

A variable is a characteristic recorded for each person in a study. Qualitative (categorical) variables are nominal, with no order, or ordinal, with a natural order; quantitative variables are discrete (counts) or continuous (measurements). Naming the type is the first step of any analysis, because it sets the right summary (proportion, median or mean) and the right statistical test.

Structure

  • Qualitative or categorical: nominal and ordinal.
  • Quantitative or numerical: discrete and continuous.
  • Interval scales (no true zero, such as temperature in degrees Celsius) and ratio scales (a real zero, such as age) are subtypes of continuous data.

Worked example

  1. Data: a clinic records in 200 patients their sex, pain (none, mild, moderate, severe), emergency visits in the past year and systolic pressure.
  2. Sex is nominal: 118 of 200 are women, so 118/200 = 0.59 (59%). It is summarised with a proportion.
  3. Pain is ordinal: it is summarised with the median or the percentage in each category, not with an average of ‘points’.
  4. Emergency visits is discrete (0, 1, 2…): it is summarised with the mean or the median depending on its shape.
  5. Systolic pressure is continuous: it is summarised with the mean and standard deviation if it is symmetric.
  6. To compare two clinics: sex with chi-square, pain with Mann-Whitney and systolic pressure with a t test.
  7. Reading: the same group of patients yields four types of data, and each needs its own summary and its own test.

Types of variables, their summary and a typical test for comparing two groups

TypeExampleSummaryTest for two groups
NominalBlood group, sexCounts and proportionsChi-square or Fisher exact test
OrdinalTumour stage, pain scaleMedian and interquartile rangeMann-Whitney
DiscreteNumber of admissionsMean or median depending on shapet test or Mann-Whitney
ContinuousBlood pressure, heightMean and standard deviation (symmetric)t test

Common pitfalls

  • Coding categories as numbers (1 = mild, 2 = moderate) does not make them quantitative: averaging those codes means nothing.
  • Treating an ordinal scale as continuous is reasonable only when it has many levels and a roughly normal shape.

Test yourself

Think of the answer, then tap the question to see it.

What type of variable is cancer stage (I, II, III, IV)?

Ordinal: the categories are ordered, but the gap between one stage and the next is neither equal nor measurable.

What type of variable is the number of falls in a year?

Quantitative discrete: it is a count of whole numbers.

Why does the type of variable decide the statistical test?

Because each test assumes a scale: proportions are compared with chi-square, means with a t test and ordinal data with rank tests.

What is lost when a continuous variable is dichotomised?

Information and statistical power: two people on either side of the cut-off land in different groups although they barely differ.

Add to my cards (4)

Connections

← All of epidemiology

Educational content on epidemiological and statistical methods; the examples use made-up numbers to teach the calculation. Not a clinical or legal guide: current Colombian rules are in the official sources.

Sources: Principles of Epidemiology | Lesson 2 - Section 2 (Centers for Disease Control and Prevention, 2012); Principles of Epidemiology | Lesson 2 - Section 8 (Centers for Disease Control and Prevention, 2012).

Spotted a mistake?We are always improving for the community. Tell us what is wrong and our team will review it.Report a mistake

Representative model, for educational purposes only.