A variable in statistics is any characteristic, number or quantity that can take more than one value across the people or things you measure. In statistical analysis, the type of a variable — and, more precisely, its level of measurement — decides how you can summarise it and, crucially, which statistical test you are allowed to run on it. Get the variable type right and the rest of the analysis falls into place; get it wrong and even a powerful technique will produce a meaningless answer.
That is the angle this guide takes. If you only want a plain catalogue of variable types (independent, dependent, control and so on), our general guide to types of variables covers that in full. Here we focus on variables as they actually appear in statistical tests: how they are classified by data family and measurement level, the roles they play in a study, and how those two classifications together point you to the right analysis.
“A variable is any characteristic, number, or quantity that can be measured or counted. A variable may also be called a data item.” — Australian Bureau of Statistics, Statistical Language glossary
What Is a Variable?
A variable is an attribute to which different values can be assigned. The value can be a category, a count or a measured quantity. It is sometimes called a data item — in short, it is anything that can vary from one observation to the next. The opposite of a variable is a constant, a quantity that never changes (the speed of light, or the number of days in a non-leap year). Examples of variables include gender, monthly expenses, hair colour, the number of schools in a city, blood pressure and reaction time.
For statistical purposes, variables are described in two complementary ways, and you need both to plan an analysis:
- By role in the study — chiefly independent (the presumed cause you manipulate or compare) and dependent (the outcome you measure), with supporting roles such as control, confounding and moderator variables.
- By level of measurement — nominal, ordinal, interval or ratio. This is the classification that determines which descriptive statistics and which test are valid.
Most variables also fall into one of two broad data families: categorical (qualitative) or quantitative (numeric). The two systems overlap — categorical variables are usually nominal or ordinal, while quantitative variables are usually interval or ratio — but it is worth keeping them apart in your mind, because role and level answer different questions. We will look at each family first, then map them onto the four measurement levels, and finally show how the pairing of variables drives test choice.
