# Multiple linear regression: observations with 2 or more values per factor / categories - a problem?

Is it a problem for linear regression (lm in R) to have observations that have multiple values for a given factor? For example, I have the weekly average sales Y for many products and for each product I have information about the color (X1), technology (X2), design (X3). With these three categorical variables, I want to see which might be indicative of higher / lower average weekly sales (Y).

Is it a problem if products can take on several values in a factor? For example, suppose there are 20 different colors (X1) across all products and that product ABC comes in three colors, 5 technologies X2 and 2 designs X3.

Can I handle this with OLS / linear regression using LM in R, or will I get wrong results?

Also, it is not a problem that all my predictor variables are categorical, correct?

• There is nothing inherently wrong with having multiple levels in a factor, however keep in mind that increasing factor levels means you will need larger and larger samples to cover all the possible combinations and obtain a good power. I don't know how big your sample is, but 20 colors seems... a little big. – user2974951 Feb 6 at 11:28
• I have 5 factors in total in my real situation. The factors have 5, 3, 14, 26, and 18 factor levels. My sample size is about 4600. So, it could be indeed that certain combinations have very little size (i.e. only a few products that have some combination). – Amonet Feb 6 at 12:38
• Given your factors there are a total of 5*3*14*26*18=98280 possible combinations, which is way too much, much more than you have available data. So you will have to either drop some levels or aggregate them. – user2974951 Feb 6 at 12:40
• Forgive my ignorance; is this also the case if a certain product (observation) only has 2 out of 5 levels of a factor, for example? – Amonet Feb 6 at 12:54
• The regression model that you will use does not know that, which means that the model will not test only the combinations that are available in the data, but it will test all the possible combinations. – user2974951 Feb 6 at 13:00