Last answered:

22 Nov 2021

Posted on:

18 Nov 2021

1

Resolved: This is a reference to Creating Dummies

Column A has (M for Males and F for Females)
Column B has (G for Germany and C for Canada)

Can i create a dummy variable below:

column A.map( {M:1,  F:2} )

and similarly

column B.map( {'G':1,  'C':2} )



That's using the same dummies values(1,and 2) for the different columns (A and B)

2 answers ( 1 marked as helpful)
Instructor
Posted on:

22 Nov 2021

0

Hey Derry,

Thank you for your question!

Yes, you can, in principle, map the categorical variables to values different from 0 and 1. This would not affect the end result.

According to best practice, however, the values 0 and 1 are generally used as they are easily interpretable. Zero would represent the absence of a certain category, whereas unity would represent its presence. Using values different from 0 and 1 would also make the regression equation more difficult to interpret.

Hope this helps!

Kind regards,
365 Hristina

Posted on:

22 Nov 2021

0

Thanks so much

Submit an answer