Skip to content
Scintria
ToolsGrant writerFunding
HomeLiteratureClinical trialsEvidence LabProtocol packData analysisLearnProjectsLibraryReferencesApplications
Start free
ScintriaStart free

Learn / Biostatistics / Data and description

Types of data and scales of measurement

12 minute read · 6-question quiz

Download this lesson as a colour Word or PDF study guide with the figures and answers. Included in paid plans; reading and quizzes stay free.Sign in

What you will learn

  • Tell categorical from numerical variables, and nominal from ordinal, interval and ratio scales

  • Choose the right way to summarise and analyse a variable from its type

  • Avoid the most common mistakes: treating codes as numbers, and throwing away information by grouping

Every study starts with a table: rows are participants, columns are variables. Before you calculate anything, you must know what kind of variable each column is, because the kind decides which summary, graph and test are allowed. A mean of HIV status codes (0 = negative, 1 = positive) can be meaningful; a mean of district codes (1 = Kampala, 2 = Wakiso, 3 = Mbarara) is nonsense, even though both are "numbers" in the spreadsheet.

Observation, variable and value

An observation (or unit) is the thing you measure: a patient, a household, a clinic, a village. A variable is a characteristic that differs between observations. A value is what one observation has for that variable. A trial of a malaria vaccine in children might record age (value: 14 months), sex (female), haemoglobin (9.8 g/dL), malaria episodes in the year (2) and WHO clinical stage (II).

VariableCategoricalputs people in groupsNumericalmeasured or countedNominalno order: blood groupOrdinalordered: cancer stageDiscretecounts: episodesContinuousany value: weight
The family tree of variables: first ask whether it groups people or measures them.

The four scales

Statisticians describe how much information a variable carries using four scales, from weakest to strongest.

ScaleWhat you can sayExamplesTypical summary
NominalSame or differentSex, blood group, district, HIV statusCounts, percentages, mode
OrdinalSame, different, and more or less (but gaps are not equal)WHO clinical stage I–IV, pain score 0–10, education levelMedian, percentages by level
IntervalDifferences are meaningful; no true zeroTemperature in °C, calendar yearMean, SD
RatioDifferences and ratios are meaningful; true zeroWeight, CD4 count, blood pressure, age, incomeMean, SD, geometric mean, ratios

Why true zero matters

Twenty degrees Celsius is not "half as hot" as forty, because 0 °C is just a convention (convert to kelvin and the ratio is 293 K to 313 K). But 40 kg really is twice 20 kg, because 0 kg means no mass. Only ratio-scale variables allow statements like "twice as much" or "a 30% reduction".

Discrete and continuous

Numerical variables are discrete if they take separate values, usually counts (children in a household, number of clinic visits), and continuous if they can take any value in a range, limited only by how precisely you measure (height, viral load, time to death). Real data on a continuous variable are always rounded, so a weight recorded as 62 kg really means "between 61.5 and 62.5".

Binary variables: the special case

A variable with only two categories (alive/dead, infected/not infected, treated/control) is binary. It is nominal, but coding it 0/1 lets you take a mean that equals the proportion with the characteristic. If 18 of 120 children have anaemia, the mean of the 0/1 variable is 18/120 = 0.15 = 15%. Most of biostatistics for yes/no outcomes rests on this one fact.

Classify the variables in a Ugandan cohort

A study of 400 adults starting antiretroviral therapy records: (1) sex, (2) district, (3) WHO clinical stage (I to IV), (4) CD4 count (cells/µL), (5) number of missed clinic visits, (6) viral suppression (yes/no), (7) body-mass index, (8) BMI category (underweight, normal, overweight, obese).

  1. Sex: nominal (binary).
  2. District: nominal.
  3. WHO stage: ordinal (stage IV is worse than III, but the gap between I and II is not the same as between III and IV).
  4. CD4 count: continuous, ratio.
  5. Missed visits: discrete numerical (a count).
  6. Viral suppression: nominal (binary), the outcome.
  7. BMI: continuous, ratio.
  8. BMI category: ordinal.

Notice that variables 7 and 8 describe the same thing. Keep the continuous version for analysis and make categories only for presentation.

Why the type decides everything

The type controls three decisions you will make in every analysis:

  1. Summary: percentages for categories, mean and SD (or median and IQR) for numbers.
  2. Graph: bar chart for categories, histogram or box plot for numbers.
  3. Test or model: chi-square or logistic regression for a categorical outcome; t-test or linear regression for a continuous outcome; Cox regression for time to an event.

Mistake 1: treating codes as quantities

Coding 1 = Kampala, 2 = Wakiso, 3 = Mbarara and then averaging the codes produces a meaningless 1.9. Store categorical variables as labelled categories, not bare numbers. Check your software knows they are categories, or it will happily put them in a regression as if district 3 were "three times" district 1.

Mistake 2: categorising a continuous variable

Splitting age into "under 40" and "40 or over" throws away information: a 39-year-old and a 41-year-old become different, while a 41-year-old and a 79-year-old become identical. Grouping a continuous variable in an analysis typically loses statistical power (a 2-group split of a normally distributed predictor can cut the effective sample size by about a third) and can create false thresholds. Keep it continuous, and group only for tables.

Ordinal scales with many levels

A 0 to 10 pain score or a 5-point Likert scale is ordinal in principle. With many levels and a roughly symmetric distribution, many analysts treat it as numerical and use means, but you must be able to defend that choice. With only 3 to 5 levels, report the percentage at each level and use methods for ordered categories.

CategoricalNumericalNominal: no order (blood group)Ordinal: ordered (stage I to IV)Summarise with counts and percentagesDisplay with bar chartsDiscrete: counts (visits)Continuous: measurements (weight)Summarise with mean and SD, or median andIQRDisplay with histograms and box plots
A one-glance guide: the type of variable decides the summary and the graph.

Data quality starts with the data dictionary

A data dictionary lists, for each variable: its name, label, type, allowed values or range, units and how missing values are coded. Write it before data collection. It prevents "999" being averaged as if it were a real CD4 count, and it makes your dataset usable by someone else (or by you in two years).

Units and precision

Record the unit with every measured variable and keep one unit per variable (all weights in kg, never a mix of kg and pounds). Record at the precision the instrument supports, not less: you can always round later, but you can never recover a decimal you did not record.

Summary

  • Variables are categorical (nominal or ordinal) or numerical (discrete or continuous); the type decides the summary, the graph and the test.

  • Only ratio-scale variables support statements like 'twice as much'; interval scales have no true zero.

  • A binary variable coded 0/1 has a mean equal to the proportion with the characteristic.

  • Never treat category codes as quantities, and do not split continuous variables into groups for analysis.

  • Write a data dictionary before you collect data.

Check your understanding

Question 1
1

A study records the WHO clinical stage (I to IV) of patients. This variable is:

Question 2
2

Which statement is valid for a ratio-scale variable but NOT for an interval scale?

Question 3
3

In a sample of 120 children, 18 have anaemia (coded 1) and 102 do not (coded 0). The mean of the variable is:

Question 4
4

The number of antenatal visits a woman attended is best described as:

Question 5
5

Why is it usually a poor idea to convert age into 'under 40' and '40 or over' before analysis?

Question 6
6

District is coded 1 = Kampala, 2 = Wakiso, 3 = Mbarara. Averaging these codes gives 1.9. This is wrong because district is:

Draft study guide. Spotted an error or something unclear? Tell us at hello@scintria.com. This is educational material, not clinical or regulatory advice.

Summarising data: centre, spread and shape