Types of Variables > Binary Variable

## What is a Binary Variable?

A binary variable is a variable with only two values. For example:

- 1 / 0.
- Yes / No.
- Success / Failure.
- Male / Female.
- Black / White
- Take the red pill, or the blue pill?

.

Although binary variables are commonly used in statistics (i.e. for the binomial distribution), the term “binary variable” is seldom used. This may be in part because it’s rare to come across a variable that only has two choices outside of a Bernoulli distribution.

A binary variable is the same thing as a “bit” in computer science or a “truth value” in mathematical logic. They are basically different names for the same thing, much like statisticians call a Bell curve a “Normal Distribution” and physicists call it a “Gaussian distribution.”

## Types of Binary Variables

Binary variables can be divided into two types: opposite and conjunct.

**Opposite binary variables**are polar opposite, like “Success” and “Failure.” Something either works, or it doesn’t. There’s no middle ground.**Conjunct binary variables**aren’t opposites of each other. They have more of a grey area. For example, in the United States you can be affiliated with the Democrat or Republican parties. In real life though, most people aren’t staunchly republican or staunchly democrat. It’s common for people to flip flop between parties, agree with 20% of what the other party says (making them 20% of one party and 80% of the other) or even to identify as another party entirely, like the Green Party.

## Dummy Variables and Binary Variables

The terms dummy variable and binary variable are sometimes used interchangeably. However, they are not exactly the same thing. A dummy variable is used in regression analysis to quantify categorical variables that don’t have any relationship. For example, you could code 1 as Caucasian, 2 as African American, 3 as Asian etc. If your dummy variable has only two options, like 1=Male and 2=female, then that dummy variable is also a binary variable.

If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.

Comments are now closed for this post. Need help or want to post a correction? Please post a comment on our Facebook page and I'll do my best to help!