So I am new to regression and I have a basic doubt:

Let's say I have 100 unique products(product id) which have a lot of other features that contribute in calculating the product_price(dependent variable). Some of the features worth mentioning are Quantity_sold, Region, Supplier etc.

My aim is to calculate the price of each of the product at a

"Product_id, Quantity_sold,Region,Supplier" level

i.e. the ideal output of the predicted price should be as follows:

Product_id Quantity_sold Region Supplier Product_price
1023       25        Texas      AMC      20

Now my question is should i first filter the data for specific product_id, quantity, region,supplier and then run linear regression or should i run the linear regression on the whole data set containing all the product id, quantity,region, supplier.

In case I should run the regression on the entire data set, then should i convert the region(more than 100 unique values), supplier(more than 300 unique values) etc into dummy variables or remove them all together.

This question may sound very novice to you, but I would really appreciate some explanation as to how do we usually go about solving such problems in regression.


1 Answer 1


Using a mixed model might be a solution to your problem. It avoids having 400+ dummy variables. A mixed model might also be preferable to dropping the variables Region and Supplier completely, because they probably contain information relevant to the price and therefore create dependencies between observations.

I don't know the size of your dataset and the amount of time you have, but doing individual regressions for every combination of region and supplier seems like overkill to me. However, I don't think you can really avoid having individual models for every product. I imagine their prices behave quite differently. Quantity_sold (or a monotonic transformation) can be modeled as a fixed effect in such a mixed model.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.