I am very interested in R and prediction models. I already used different models like ols, flexible ols, lasso, Regression trees and so on for american household data which was already perfectly prepared.

Now I am trying to do a more complex prediction of the amount of sold quantity of 5 different products. I got data on the amount of Sales channels and Dates (weekstart). Availability of products in sales channels per weekstart and product price. Also a Logical variable which indicates if there was promotion in a certain week, for product x and ad spending for TV and radio.

SO what I did so far was factorizing certain variables like the product names,Logical variable, weekstarts, Sales channels(A-F).So I can perform a linear Regression including variable declaration that R can work with. I did that by simply using factor(). Sidenote: I have no NA or missing values as well as completly out of range values like a price of a billion Dollar or something.

Now after creating test and Train data, using this Code to make a prediction seems to simple:

fmla=QuantitySold ~ (Channel + WeekStart + Price + isPromoPeriod + TV +     Online + StoresAvailability)

basic= QuantitySold ~ (Channel + WeekStart + Price + isPromoPeriod + TV +    Online + StoresAvailability)
regbasic= lm(fmla,data=train)
regbasic #estimated coefficients
summary(regbasic) #number of regressors $df[1]

this gives me a model which has 184 (since there are a lot of weeks) regressors and 233undefined coefficients because of singularity.

I know that a simple linear Regression does not hold for the complex combination of Promotion(true/fals), Channels, Prices and weeks..

Long Story short: My Question is if this even is the right start for a task like this?


migrated from stackoverflow.com Oct 10 '18 at 9:35

This question came from our site for professional and enthusiast programmers.

Your Answer

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