Variable

Beginner

What you need first. Read Dataset. This page is part of Fundamentals.

‹ Dataset Levels of measurement ›

In statistics, a variable is a characteristic that is measured or counted on each unit. A unit is the thing being studied. A variable is the characteristic that is written down about it: a number, a count, or a category. [1] [2]

Variable

Variable
Fact Value
Topic Fundamentals
Listed on Fundamentals
Worked example 1

Motivating example

In a ward, each patient is a unit. Age, sex, and creatinine are three variables. Age and creatinine are numerical. Sex is a category. The analysis that is legal for creatinine, a mean or a regression on dose, is not legal for sex merely because someone stored sex as 0 and 1. [2] [2] [1]

Intuition

A variable is a question asked of every unit. “How tall?” and “which ward?” are different questions. The column is the list of answers. The name of the column is the variable. [1] [1]

Definition

A variable is any characteristic, number, or quantity that can be measured or counted. [1] A quantitative variable has numerical values, such as weight, age, or a count of children. Discrete quantitative variables take distinct whole values. Continuous ones can fall anywhere in an interval, as a length can. [2] [1] [1]

A qualitative, or categorical, variable has categories. Those categories may be unordered, a nominal scale, or ordered, an ordinal scale. [2] [1] [1]

In a regression the response, or dependent variable, is the one treated as varying with the others, which are the explanatory variables. [2]

Properties

The level of measurement is a property of the variable, not of the software column. A code is still nominal if the categories have no order. An ordered rating is still ordinal if the gaps between ratings are not lengths. [2] [1] [1]

Data are called quantitative, qualitative, discrete, or continuous according to the variable they record. [2]

Statistical use

The variable decides the summary. A nominal variable is described by frequencies. A quantitative variable can also be described by a mean. A model then says how one variable changes with others. The parameters of that model are not variables of the units; they are features of the population description. [2] [1] [2]

Worked example

Six animals have species codes cat, dog, cat, cat, dog, rabbit, and masses in kilograms 4, 12, 5, 4, 9, 2. Species is categorical. Its frequencies are cat 3, dog 2, rabbit 1. Mass is quantitative. Its mean is (4+12+5+4+9+2)/6 = 36/6 = 6. [2] [2] [1]

Your turn. The rabbit’s mass was recorded in grams as 2 by mistake and is corrected to 2 kg, which it already is, and a seventh animal is a 3 kg cat. What are the frequency of cat and the mean mass?

Cats now number 4 out of 7. The masses are 4, 12, 5, 4, 9, 2, and 3. Their total is 39, so the mean is 39/7.

Common misconceptions

A variable is not a unit and not a parameter. The column of masses varies from animal to animal. The population mean of mass is a single unknown number, a parameter, even though it is estimated by a variable’s sample mean. [2] [1]

Storing a category as a number does not create a quantitative variable. [2] [1]

Assumptions and limits

Calling a variable continuous is a modelling choice. A recorded length is discrete at the resolution of the instrument. The continuous description is useful when that rounding is fine relative to the variation under study. [2] [1]

Connections

Levels of measurement name the scale. An explanatory variable and a response variable are roles in a model, not scales. A random variable is the probability-language version of a variable whose value is not fixed in advance. [2] [1]

Check yourself

Try these questions before opening an answer.

Frequency of a category

Six animals have species cat, dog, cat, cat, dog, rabbit. A seventh animal is a cat. How many cats are there?

There are 4 cats.

A code is not a mean of the category

Pain is coded 1, 2, 3 for none, mild, and severe. The codes of three patients are 1, 3, and 2. Why is the average 2 not a pain?

The codes name ordered categories. Their average is an average of codes, not a pain on that scale.

History

Once records were organised by characteristics of units, it became possible to ask how one characteristic moves with another. That question is the start of regression and of the models that followed it. [2] [2]

See also

Data · Dataset · Levels of measurement · Population · Census · Sample · Parameter

Glossary and index

References

  1. ^ a b c d e f g h i j k l m n o p q a. (Glossary, “Variable (data item)”) b. (Glossary, “Numeric variable”) c. (Glossary, “Data item (or variable)”) d. (Glossary, “Categorical variable”) e. (Glossary, “Variable (data item)”) f. (Glossary, “Discrete variable”) g. (Glossary, “Continuous variable”) h. (Glossary, “Nominal variable”) i. (Glossary, “Ordinal variable”) j. (Glossary, “Qualitative data”) k. (Glossary, “Quantitative data”) l. (Glossary, “Frequency”) m. (Glossary, “Mean”) n. (Glossary, “Statistic”) o. (Glossary, “Nominal variable”) p. (Glossary, “Continuous variable”) q. (Glossary, “Variable (data item)”) Australian Bureau of Statistics (2023). Statistical terms and concepts glossary. Australian Bureau of Statistics. https://www.abs.gov.au/statistics/understanding-statistics/statistical-terms-and-concepts/statistical-terms-and-concepts-glossary
  2. ^ a b c d e f g h i j k l m n o p q r a. (p. 440) b. (p. 439) c. (p. 440) d. (p. 440) e. (p. 439) f. (p. 161) g. (p. 439) h. (p. 150) i. (p. 353) j. (p. 412) k. (p. 208) l. (p. 440) m. (p. 412) n. (p. 439) o. (p. 440) p. (p. 353) q. (p. 353) r. (p. 518) Dodge, Yadolah (2008). The Concise Encyclopedia of Statistics. Springer. https://doi.org/10.1007/978-0-387-32833-1
Cite this page
Plain text
StatWiki (2026). "Variable." StatWiki. Last updated 2 December 2026. https://www.statwiki.io/articles/variable.html
BibTeX
@misc{statwiki_variable,
  author = {{StatWiki}},
  title = {{Variable}},
  year = {2026},
  url = {https://www.statwiki.io/articles/variable.html},
  urldate = {2026-12-02},
  note = {StatWiki, last updated 2 December 2026}
}