I'm running a multiple linear regression with (amongst others) several categorical explanatory variables. My categorical variables are factors with several factor levels. For example, variable $x_1$ describes the number of residents in a dwelling and has the levels 1, 2 and >2. Another variable describes when the dwelling was built, so it exhibits levels like <1980, 1980-1989,... and so on.
Normally, using a linear model function, e.g.
lm() in R, each categorical variable is reported as one variable in the ANOVA table. Only degrees of freedom are adjusted according to the number of factor levels.
(I'm using R, but i assume this works similarly with other software.)
However, since I have to use a model function in R that does not support categorical variables (in
plm() all variables have to be numeric), I included each factor level as dummy variable, e.g.
y ~ ... + (x_1 == "1") + (x_1 == "2") + (x_1 == ">2") + ...
Are ANOVA results from both cases - i.e. including categorical variables directly or turning them into dummy variables according to their factor levels - the same? Is the second method (model) actually correct?