Next, important thing we need to know is how to handle the categorical variables in a set of independent
variables.
If you remember, in our dataset, we have variables like airport, which has values yes and no, and
there is a variable called waterboarding, which has values such as lake.
There were several.
No regression model works on real numbers.
If you don't understand a non numerical variable such as airport.
How can we handle this problem?
It is simple, we just need to assign a numerical value to each of the categories of that variable.
If the category names are numbers, the models can run.
But we cannot assign any number to the categories as this will impact the modern.
We need to follow proper process.
So this process of properly creating a dummy variable, which will represent an actual variable containing
non numerical values, is called a dummy variable creation.
So why we do it, because regression analysis cannot handle non numeric data.
And how we do it, we first create a new variable or set of variables, that is the dummy variable.
And these new variables are given values of either zero or one and not anything else.
But why?
Why not reassign values like one, two and three, etc.?
Let us look at the categories in this example for clarification.
On the left, I have students and their favorite subject, on the right, I'm calling this subject.
The first step of the military creation is creating dummy variables.
How many variables do we need to remember this, the number of dummy variables required to replace a
variable is number of categories in that variable, minus one.
That is, if there are two categories we need to minus one, the military rules, that is only one variable.
If you have three categories, like in our example, we need three minus one.
That is to the variables.
So I have three subjects here, science, English and maths.
So I have created two dummy variables, one for science and one for Max.
Science has value of one if the subject is science and it has value zero.
So if you look at the first two, it has scientism one.
And the other two are the subject is English and math.
It has value zero.
Matt has value one, if this object as bad as it has value zero, so the fourth rule as one in the match
column and all the other rules as zero.
This means if both are you, then this object is English, so the third row, as both you do with representing
the third subject.
Clearly, these zeros and ones are representing each category.
Of the favorite classmate, Evelyn.
Now, to answer the question why we created two dummy rebels, then we could have created a single one
with value, such as one for science, two formats and three for English.
This is because one, two, three have more meaning.
That is.
So it, too, is actually two days of fun.
But match is not higher than our modern times.
Math, science and English are nominal data.
It just says the name of the favorite subject.
So we cannot assign numerical values which can be ordered.
Whereas when we are sending zero and one, it only represents true or false or and signal.
Therefore, we create in minus one dummy variables.
The value of each dummy variable is one for one single category, and the category has all.
As zero value for all the and minus one dummy variables.
How to interpret the results of a regression analysis containing dummy variables ordered like this will
be discussed after we ran the aggression on our data.