Categorical variables
As you saw in the case with continuous variables in the previous section, it is quite straightforward to understand the relationships between the input and output variables from the coefficients and p-values. However, it becomes not so straightforward when we introduce categorical variables. Categorical variables often do not have any natural order but, in linear regression, we need the input variables to have numerical values that signify the orderings or magnitudes of the variables. For example, we cannot easily encode the State variable in our dataset with certain orders or values. That is why we need to handle categorical variables differently from continuous variables when conducting regression analysis. In R, the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access