we know that for non-numeric categorical features, such as country, color, they can be transform into numeric value by one-hot encoding.
For instance, suppose there are 7 color options for a car, red will then be encoded as [0 0 0 1 0 0 0]. We can therefore include these 7 numeric values into a logistic regression model.
However, one of linear regression's assumptions is that, predictors are independent. One hot encoding obviously violates this assumption.
Probably I miss understood something here. Any thoughts?
PS: as answered by Dave and Gordon below: the trick is to use 6, instead of 7, new features. None of these 6 could be a linear combination of the other 5.
+color
in the linear model formula and the correct number of coding variables will be created automatically. You never need to create the coding variables yourself. $\endgroup$ – Gordon Smyth Oct 1 '19 at 8:25