Learn / Biostatistics / Data and description
Types of data and scales of measurement
12 minute read · 6-question quiz
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).
The four scales
Statisticians describe how much information a variable carries using four scales, from weakest to strongest.
| Scale | What you can say | Examples | Typical summary |
| Nominal | Same or different | Sex, blood group, district, HIV status | Counts, percentages, mode |
| Ordinal | Same, different, and more or less (but gaps are not equal) | WHO clinical stage I–IV, pain score 0–10, education level | Median, percentages by level |
| Interval | Differences are meaningful; no true zero | Temperature in °C, calendar year | Mean, SD |
| Ratio | Differences and ratios are meaningful; true zero | Weight, CD4 count, blood pressure, age, income | Mean, SD, geometric mean, ratios |
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.
Why the type decides everything
The type controls three decisions you will make in every analysis:
- Summary: percentages for categories, mean and SD (or median and IQR) for numbers.
- Graph: bar chart for categories, histogram or box plot for numbers.
- 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.
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
Draft study guide. Spotted an error or something unclear? Tell us at hello@scintria.com. This is educational material, not clinical or regulatory advice.