I have an independent variable called "quality"; this variable has 3 modalities of response (bad quality; medium quality; high quality). I want to introduce this independent variable into my multiple linear regression. When I have a binary independent variable (dummy variable, I can code 0
/ 1
) it is easy to introduce it into a multiple linear regression model.
But with 3 modalities of response, I have tried to code this variable like this :
Bad quality Medium quality High quality
0 1 0
1 0 0
0 0 1
0 1 0
But there is a problem when I try to do my multiple linear regression: the modality Medium quality
gives me NA
:
Coefficients: (1 not defined because of singularities)
How can I code this variable "quality" with 3 modalities? Do I have to create a variable as a factor (factor
in R
) but then can I introduce this factor in a multiple linear regression?