# Need clarification on using Qualitative Predictors in the Regression Model


$\Balance = B_0 +B_1 * \Income + B_2 * \operatorname{Gender}$

Gender is a qualitative variable so we are going to use a dummy variable such that it is 0 when its male and 1 when its female.

So,

$\Balance(\Income,\operatorname{Male}) = B_0 + B_1 * \Income$

$\Balance(\Income, \operatorname{Female}) = B_0 + B_1 * \Income + B_2$

Does this mean that being a male has on effect on the balance and if you are a male, your balance would depend only on the income? And if you are a female, then your balance depends on both you income and gender?

No, although on the outset it might look like the Gender variable is only having an effect on the Females. The intercept term $B_0$ is affected by the introduction of the Gender variable.

Let us run a simple simulated experiment to explain what I mean

B0 = 10
B1 = 5
B2 = 3
Income = c(100000,80000,45000,60000,120000,140000,110000,55000,54000,53000,63000,74000)
Gender = c(rep(0,5),rep(1,7))

set.seed(101)
Balance = B0 + B1 * Income +  B2 * Gender + rnorm(12)


Now, that we have some simulated data to work with, let us run a regression model with only Income as a variable and check the results

fit.lm1 <- lm(Balance ~ Income)
summary(fit.lm1)
Call:
lm(formula = Balance ~ Income)

Residuals:
Min      1Q  Median      3Q     Max
-2.4020 -1.6617  0.6716  1.5320  2.1645

Coefficients:
Estimate Std. Error   t value Pr(>|t|)
(Intercept) 1.137e+01  1.548e+00 7.346e+00 2.47e-05 ***
Income      5.000e+00  1.825e-05 2.739e+05  < 2e-16 ***


Now, let us include the Gender variable and run this model again.

fit.lm2 <- lm(Balance ~ Income + Gender)
summary(fit.lm2)
Call:
lm(formula = Balance ~ Income + Gender)

Residuals:
Min       1Q   Median       3Q      Max
-1.05399 -0.30172 -0.02495  0.37714  0.84589

Coefficients:
Estimate Std. Error   t value Pr(>|t|)
(Intercept) 9.254e+00  5.273e-01 1.755e+01 2.87e-08 ***
Income      5.000e+00  5.669e-06 8.820e+05  < 2e-16 ***
Gender      3.310e+00  3.398e-01 9.741e+00 4.45e-06 ***


You can now clearly see how the intercept term is effected by introduction of Gender variable.

In the first case, the model was estimated to be $Balance = 11.37 + 5 * Income$ for everyone

While in the second case, the model became

$Balance = 9.25 + 5 * Income$ for Males and

$Balance = 12.56 + 5 * Income$ for Females

By introducing the Gender term the model intercept changed from 11.37 for everyone to 9.25 for Males and 12.56 for females, so it indeed has an affect both males and females. Hope that clarifies your question.

• Thanks :) yes your answer has clarified my ambiguities. Unfortunately I can not cast you a vote since i don't have 15 reputation. But thanks again :) – Bakhtawar Jan 8 '17 at 12:27