When performing regression with categorical variables, in order to avoid multicollinearity, it is necessary to drop one level. This is clear in fact:
Let's assume I have a binary categorical variable (A, B) and the following data:
id, cat, y
1 A y_1
2 B y_2
3 B y_3
4 A y_4
...
where id is just an index a y the target variable, the design matrix (with the intercept), the design matrix will look like the following (dropping A and setting it as the base level):
id, intercept, cat_B, y
1 1 0 y_1
2 1 1 y_2
3 1 1 y_3
4 1 0 y_4
...
This makes perfect sense as, if we keep both the indicator for A and B, the column for A (cat_A) will be linearly dependent to the column (cat_B) and the matrix is not invertible.
What I do not understand is that if we do not have an intercept we do not have to drop one level and we have the following:
id, cat_A, cat_B, y
1 1 0 y_1
2 0 1 y_2
3 0 1 y_3
4 1 0 y_4
...
and now the linear regression can be performed. Cat_A column and Cat_B column are still linearly dependent. Why this is not a problem anymore?
cat_A = 1 - cat_B
. it seems they are, right? $\endgroup$