A variable is a measurable property that can take different values across individuals or observations. Height, temperature, color, and income are all variables. In statistics, variables are classified by their type: a quantitative variable takes numerical values (continuous like height, or discrete like count), while a categorical variable takes labels (nominal like color, or ordinal like rating).
A random variable is the formal mathematical version: a function X: Ω → ℝ (or more generally, to some measurable space) from the sample space to a set of values. The random variable assigns a numerical value to each outcome, allowing probabilistic analysis. The distribution of a random variable describes how its values are spread — summarized by mean, variance, and other measures.
In statistical analysis, variables are classified by role: independent variables (predictors, inputs) are hypothesized to influence dependent variables (responses, outputs). Confounding variables affect both and can create spurious associations. Controlling for variables — holding them constant or adjusting for them statistically — is essential for drawing causal conclusions from observational data.