Glossary · Regression
Dummy Variable
Also called: indicator variable · binary variable · one-hot encoding
A 0/1 variable that lets a regression include a category, such as region or promotion week, as a predictor.
Definition
A dummy variable equals 1 when an observation belongs to a category and 0 otherwise, so its regression coefficient measures the average difference between that category and the baseline, holding other variables constant. A categorical variable with c categories needs c − 1 dummies; including all c alongside an intercept creates perfect multicollinearity, known as the dummy variable trap. Interacting a dummy with another predictor lets the slope, not just the level, differ between groups. In machine learning the same idea is called one-hot encoding.
Formula
TeX source
y = \beta_0 + \beta_1 x + \beta_2 D + \varepsilon, \qquad D \in \{0, 1\}Worked example
Try it in a tool
Related terms
- Linear Regression: A statistical method that models an outcome as a linear combination of predictors, choosing coefficients that minimize the sum of squared errors.
- Multicollinearity: High correlation among a regression's predictors, which makes individual coefficient estimates unstable and their standard errors large.
- Logistic Regression: A regression model for yes-or-no outcomes that predicts the probability of an event by passing a linear score through an S-shaped logistic function.
- R-Squared: The share of the variation in an outcome that a regression model explains, from 0 to 1.