A data set can contain indicator (dummy) variables, categorical variables and/or both. Initially, it all depends upon how the data is coded as to which variable type it is.
For example, a categorical variable like marital status could be coded in the data set as a single variable with 5 values:
1 Never Married
2 Currently Married
Or it could be coded as a set of four indicator variables:
The fifth category, Never Married, doesn’t need it’s own variable because we have already indicated that category with a set of 0s on all four indicator variables.
Turning categorical variables into indicator variables and vice versa can be done using any statistical software package. In our workshops we show how to write the code to do this in Stata, SPSS, and R.
Many researchers prefer using indicator variables directly when running their analysis. They are easy to view and understand the results in a regression analysis.
In many statistical procedures it doesn’t matter if you use a categorical variable or a series of indicator variables because as soon as you specify a variable as categorical, the software does the conversion to a set of indicator variables.
But not all procedures do this for you. Let’s look at an example.
Many analytical models only use complete cases (listwise deletion) in the analysis. Complete case analysis on survey data can lead to biased results.
If the observations are missing at random (MAR), a well thought out, properly run multiple imputation model can impute values for the missing data. As a result, your analysis will contain a larger sample size and greater statistical power and be unbiased.
There are many steps involved in creating a well thought out multiple imputation model. One step requires determining if there is any missing data within the indicator variables.
If there is, the first step is to determine if the indicator is a subset of a larger group. For example, the indicator variable “married” may be one of a series of indicator variables for marital status. If there are no other indicators of marital status you can leave it as is.
If there are two or more subset indicators for a categorical group and any one of them has missing data you must combine them into a categorical variable before running a multiple imputation model.
Why is this important?
If you have subgroup indicators of marital status it is possible that an observation could have a 1 for Single, 0 for the Divorced and missing for Married. When you run the multiple imputation model it is possible to end up with an imputed value of 1 for the missing data in the Married variable. The observation would now have a “1” for Single and a “1” for Married. We know this would be inaccurate.
If you do create a new categorical variable, there are two things you must be cautious of. First, make sure you are adding all of the sub groups into your new categorical variable. Second, be sure you write your code correctly to account for the missing data.
One of the important takeaways is the importance of understanding the structure of the missing data in a data set before running a multiple imputation model. Not understanding the nuances of the missingness will lead to poor imputation and inaccurate results.
Jeff Meyer is a statistical consultant with The Analysis Factor, a stats mentor for Statistically Speaking membership, and a workshop instructor. Read more about Jeff here.