Variable

What is a variable?

A variable can mean slightly different things depending on the context. Here’s a quick overview of each contextual definition.

  • A variable in mathematics is a quantity that may change (in the context of a math problem) and is usually shown as a letter such as x or y. In more advanced math, a variable might represent a number, vector, matrix, or function.
  • A variable in computer science (or programming) is like a ‘container’ or ‘bucket’ that holds information. This allows the contents of container (pieces of information) to be referenced without requiring the name of a specific piece of information.
  • A variable in experiments (research) is anything that varies in quantity or quality. Research variables fall into three categories: independent, dependent, and controlled.
  • A variable in data sets is a property being measured (usually in a column).
  • A variable in statistics is an attribute that describes a person, place, thing, or idea and can vary over time or between data sets.

Types of variables in statistics

For a more detailed definition of variables in statistics, we need to look at the different types since each one has its own distinct meaning. Here are the most common types of variables you might encounter.

(Note: Sometimes variables have several different names, which can be confusing. We’ve only listed the most common names for simplicity.)

Independent and dependent variables

An independent variable (sometimes called ‘predictor’ or ‘experimental’ variable) is the input of an experiment that can be manipulated to affect the dependent variable (sometimes called ‘outcome,’ ‘predicted,’ or ‘response’ variable). Independent variables can be controlled, dependent variables cannot be controlled.

For example, the size (i.e. diameter) of a garden hose would be an independent variable that affects the amount of water (dependent variable) that’s able to come out. By changing the size of the garden hose, we can increase or decrease the water flow.

Independent and dependent variables can be quantitative or qualitative.

Quantitative (or numeric) variables

  • Discrete - this type of variable is a finite number (i.e. it can be counted). Generally, discrete variables contain integers (whole numbers - not decimals or fractions) and cannot be more precise. For example, the number of pets a family has is a discrete variable - it’s impossible to have 2.5 dogs or 1.5 cats.
  • Continuous - this is the opposite of discrete since it represents an infinite number. It can refer to one point within a range (or continuum). Technically, continuous variables can be infinitely more precise. For example, the weight of a dog can always be more precise with a more precise scale.

Qualitative (or categorical) variables

  • Ordinal (or ranked variable) - this is descriptive variables that have an implied order or rank. Examples of ordinal variables are small/medium/large, unsatisfied/neutral/satisfied, etc.
  • Nominal - this is sometimes just called ‘categorical variable’ and refers to descriptive variables that do not have an implicit ranking. Nominal variable examples include colors, genres, occupations, geographic location, etc.

Number of variables: univariate vs. bivariate

When the data you’re analyzing has just one variable, the data set is called univariate data. If you’re analyzing the relationship between two variables, the data set is called bivariate data.

For example, the height of a group of people would be univariate data since there’s only one variable - height. But if we were to look at height AND weight, we’d be working with bivariate data since there are two variables.

Additional resources to learn more about variables