Multiple regression - dummy or indicator variables Including Excel output
Hi. I'm Dr Nic, and in this video I'm going to explain about the use of dummy variables in multiple regression.
This video follows on from Multiple Regression, Overview.
This video is about how we can include nominal or ordinal data in a multiple regression
and how to interpret the coefficients.
I will give one extended example, then some other illustrations.
Check in the description below for more videos about multiple regression.
Some may be special content for channel members.
I will use the same data set I used in the ANOVA video about household incomes and qualifications.
This is an example based on real data about people's annual incomes and qualifications.
There are details in the description below.
For each person we have data about their level of qualification, age and their annual household income.
There are 300 observations.
First we can create a simple regression showing the relationship between age and income.
Income is the dependent variable and age is the independent variable, so income goes on the vertical axis.
There is an upward slope. This makes sense as you would expect people to earn more as they get older.
The regression model is Income = -52800 + 2600 Age.
The coefficient for Age tells us that for each year older a person is, all
other things being equal, we would expect their household income to be higher by about $2600.
We can also use the model to make a prediction.
A person who was 30 years old would have an expected household income of -52800 + 2600 times 30 which equals $25,200
Now say we wanted to see what the effect of having a degree is.
We have that data recorded in our dataset, so we can use it now.
We can put in a dummy or indicator variable to say whether the person has a degree or not.
The value for the variable, degree, is one if a person has a degree and zero if they do not.
The regression model we get is Income = -58200 + 2700 Age + 34300 Degree
The coefficient for Degree tells us that if a person has a degree, all other things being equal,
we would expect their household income to be higher by about $34300 than a
person of the same age without a degree.
Using this model, we would predict that a person who has a degree and is thirty years old
would have an expected annual household income of -58200 +2700 times 30 + 1 times 34300 = $57,100
Using this same model for a person who is thirty without a degree, the expected income would be 22,800
That is how a single dummy or indicator variable works.
We can have multiple indicator variables.
In our data set we actually have four levels of qualification,
none, school, vocational and degree.
In the ANOVA video we found that there was a statistically significant difference in mean incomes between some of the groups.
Using Multiple regression and indicator variables we can make a model that incorporates
age - a measurement variable, as well as the different levels of qualification in order to explain or predict income.
We need to have a dummy variable for each of
the different qualification levels, but one. There are four levels, so we need 4-1= three dummy variables.
The indicator or dummy variables are School, Vocational and Degree.
For each person in the database they will have at most one in one of those three variables.
If they have all zeroes, then that means that they have no qualifications - the fourth level of the variable 'qualification".
I used IF statements in Excel to create my dummy variables. You can see them here.
Here are some examples: Tasi has a degree, so there is a 0 for School and Vocational, and a 1 for degree.
Helen has no qualifications, so there are zeroes in all three columns.
This is the output from the regression using Excel
We write the model as Income = -74400 + 2800 Age+ 18100 School + 18200 Vocational + 46500 Degree
You may have noticed that the coefficients for School and Vocational are just about the same.
We can see in the boxplot that there is little difference between these two groups.
For a thirty year old with no qualifications, the expected income is -74400 + 2800 times 30.
Each of the other terms has a zero value.
For a thirty year old with vocational qualifications, the expected income is -74400 + 1 times 18,200 + 2800 times 30 which equals 27800.
The values for School and Degree are zero.
You could combine the dummy coefficient and the constant to express the model as four equations like this:
These are the equations shown on a graph. There are only three lines as the equations
for School and Vocation are pretty much the same. You can see that the lines are parallel.
This model assumes that the increase by age is the same, regardless of the qualification level.
This is possibly not a valid assumption, but we will deal with that in another video.
Here are some more examples of the use of dummy variables.
In this example the dummy variables corresponded to different levels of
qualifications. This was ordinal data.
Other instances where dummy variables are used include
gender, ethnicity or marital status.
For a model regarding car prices you might have a dummy variable for automatic or manual transmission.
Or you might use a dummy variable for whether it was imported or not.
In analysing experimental data, you might use dummy variables to indicate if the observation is in a treatment or control group.
If you were looking at outcomes of treatment of hand injuries, a dummy variable would be used to indicate if the injury is in the dominant or non-dominant hand.
When analysing customer behaviour, you might wish to indicate if the shopper was in person,
click and collect or delivery. As there are three alternatives you would need two dummy variables.
If you use a regression model for time series data that has a seasonal component,
then you would have a set of dummy variables to indicate the month or quarter of each observation.
This video has been about dummy or indicator variables in Multiple regression
If you have other aspects you would like covered or you have questions, please put in the
comments and I will see what I can do.
Please like this video, subscribe, but most of all join the channel - especially if you are using our videos in your teaching.
Help the channel grow and help me help more and more people like you and your students.
Joining the channel also gives you access to more helpful videos like these.
I am truly grateful for my channel members who help make these videos possible.
I am especially grateful for my super supporter, Ian Sim - Thank you.