To predict Product Order Quantity by Regression




I am relatively new to the field of data science and R programming.
I am faced with a requirement, where I need to perform linear regression on segmented data.
The sample data would look somewhat like this.

Customer Product Stock Previous_Quantity Ordered_Quantity

C1 P1 10 20 30
C1 P1 5 30 20
C1 P1 15 20 25
C1 P2 5 10 20
C1 P2 5 20 25
C1 P2 10 25 30
C2 P1 20 20 30
C2 P1 10 30 35
and likewise…
Hence for the combination of a Customer & Unique Product (example - C1 + P1), we have to predict the Ordered_Quantity (Response Variable), by using Stock & Previous_Quantity as the Predictor Variable.

Till now I have come across requirements where there were no segments (like Customer + Product here) for which independent predictions had to be made.
I am not getting a lead on how to proceed. Your kind assistance is highly appreciated.



Hi @amitkr.das
Here you need to create separate data sets based on customer segment.lets say now for C1, you need to regress product,stock and precious order on order quantity