In this article

What is a variable?

data categories

Difference between categorical and numerical variables

Difference between discrete and continuous variables

Are there other types of variables?

## What is a variable?

In statistics, a variable is a symbol that represents a mathematical object whose value can vary.

For example, if you're curious about the ages of people in a certain population, you can assign the variable X to represent those ages. You might also be curious about your population's political affiliation.

In this case, you could assign another variable, such as the letter Y, to represent political affiliation, where the values could be "Republican", "Democrat", or "Independent".

$X = \text{Age of subjects}$x=Age of subjects

$S = \text{Political affiliation}$Y=political affiliation

Variables fall into one of two categories:

### 1. Categorical variables

Categorical variables represent names, qualities, and other labels, which divide your dataset into groups or classes. You can also classify categorical variables as nominal or ordinal.

### 2. Numeric variables

Numeric variables represent countable or measurable quantities. You can further sort numeric variables likediscrete or continuous.

## Introduction to Statistics

Explore course## Introduction to Statistics

How data describes our world.

## data categories

Let's take a closer look at the different types of variables.

### Categorical variables (or qualitative variables)

Again, categorical variables represent qualities and labels that divide your dataset into different categories. When you select your nationality or race in a survey, your answer is stored as a categorical variable.

You can classify categorical variables as nominal or ordinal.

#### Nominal

A nominal variable is a categorical variable without ordering or ranking based on magnitude or size. Nationality, for example, is a nominal variable, as is blood type.

#### Ordinal

Ordinal variables are categorical variables in which defined groups have a rank or order based on size or magnitude.

For example, if Starbucks asks its customers what size drink they usually order (short, tall, large, or venti), the variable "drink size" is an ordinal variable. The categories you define have an order based on size.

Similarly, another example of an ordinal variable is a satisfaction index that asks respondents to judge the likelihood of purchasing a product: extremely unlikely, unlikely, uncertain, likely, very likely.

### Numeric Variables (or Quantitative Variables)

Numeric variables are countable or measurable quantities. We can divide them into discrete and continuous variables.

#### Discreet

Discrete variables are numeric variables that take on distinct, countable values. Discrete variables only accept integer values (whole numbers). The number of customers that enter a Starbucks each hour is an example of a discrete numeric variable. You can count the number of people entering the store and the number will not be fractional. Another example is the number of touchdowns a football team scores in a season. Again, such a variable takes on integer count values.

#### continuous

Continuous variables are numeric variables that take on any value within a range, where the number of possible values the variable can take on is infinite. Continuous variables can take on fractional values and often require a measuring device such as a tape measure or stopwatch to measure them.

Weights, distances and heights are examples of continuous variables. For example, NBA player weights often range from 160 to 350 pounds, but within that range, you can have weights that take on an infinite number of values: 163.239 pounds, 189.8 pounds, and so on.

## Difference between categorical and numerical variables

There is a fundamental difference between categorical and numerical variables. Categorical variables represent categories or labels and divide data into groups, while numeric variables represent counts or measures.

Take care! The distinction between categorical and numerical variables is not that one takes numbers while the other does not.

Categorical variables can take numerical values. For example, consider a variable such as zip code or month of birth. Both variables can be a number, but the number represents categorical data, not numeric data.

## Difference between discrete and continuous variables

Discrete and continuous variables are types of numeric variables. The main distinction between them is that discrete variables are countable integers, while continuous variables are measured and can take on an infinite number of values within a range.

Note that there are certain cases where we treat continuous variables as discrete variables. Age is a good example. Technically, age is a continuous variable. A person can be 11.0002 years old, 23.92305 years old, or infinite possibilities on a continuous scale. However, we are usually only interested in people's age measured in years, so we treat age as a discrete variable.

## Are there other types of variables?

In addition to the categories we've discussed, you may hear the following terminology when working with variables inStatistics.

### Independent and dependent variables

In a statistical study, a dependent variable, also called an outcome variable, is a variable whose value depends on the values of other variables in your model.

The dependent variable is the variable whose value you are trying to explain. For example, in medical research, a statistician might want to study the effect of various treatments on a patient's health. The patient's health, in this case, is the dependent variable.

On the other hand, an independent variable, also called an explanatory or predictor variable, is a variable whose value does not depend on the value of other variables in the model.

The independent variables in the model are the variables that you manipulate to see if they help explain or change the value of the dependent variable. In a causal study, an independent variable is the proposed cause and the dependent variable is the effect.

### Confounders (or Confounding Variables)

Confusing variables have the potential to invalidate your results because:

Correlate with at least one of the independent variables in your study.

Help explain the dependent variable in your study.

If not taken into account correctly, they can lead to misleading and false results.

### control variables

A control variable is a variable held constant in a statistical study. For example, imagine that you are studying the relationship between an exercise regimen and weight loss. Diet, in this case, can be a control variable in your experiment.

### Binary variables (or dichotomous variables)

A binary variable is a categorical variable with only two possible values. For example, true or false, heads or tails, win or lose.

### dummy variables

In regression analysis, a dummy variable is a binary variable that will either be 0 or 1. Dummy variables indicate whether a condition in your data is present or absent. For example, you can use 1 to show if a patient received a treatment and 0 to indicate that no treatment was received.

### Intervening Variables (or Mediating Variables)

Intervening variables, or mediators, lie between an independent variable and a dependent variable and help explain how the independent variable influences the dependent variable. These variables are not always included in your statistical analysis because they are difficult to observe. Statisticians often only make assumptions about them.

### Moderating variables (or interaction variables)

A moderator is a variable that affects the relationship between an independent variable and a dependent variable. For example, if you are studying the relationship between going to college, an independent variable, and future earnings, a dependent variable, "college" could be a moderating variable between these two variables. It is likely to influence the relationship between college education and earnings.

**Explore Outlier's award-winning credit courses**

Outlier (from the co-founder of MasterClass) brought together some of the best instructors, game designers and filmmakers in the world to create the future of online college.

Check out related courses:

## Introduction to Statistics

Explore course## Introduction to Statistics

How data describes our world.

## Introduction to Microeconomics

Explore course## Introduction to Microeconomics

Why small decisions have a big impact.

## Introduction to Macroeconomics

Explore course## Introduction to Macroeconomics

How money moves our world.

## Introduction to Psychology

Explore course## Introduction to Psychology

The science of the mind.