Question: Write an R Function oblem 2: Revenue for X Co Retail In the archive for this lab is the SQLite database xcoretail.sqlite discussed in class.

Write an R Function

Write an R Function oblem 2: Revenue for X Co Retail Inthe archive for this lab is the SQLite database xcoretail.sqlite discussed in

oblem 2: Revenue for X Co Retail In the archive for this lab is the SQLite database xcoretail.sqlite discussed in class. For each month in the range January 2011 to August 2011 (inclusive), calculate X Co Retail's total revenue for that month. Provide code, and plot the revenue by month (your y-axis can be 1 , 2,3, instead of dates, but make sure to label the axes clearly with units). A description of the database follows. This database has two tables: sales and prices. The table sales contains one row for each sale that the company made during the reporting period. The table prices has three columns: StockCode a string indicating the product identifier. Quantity an integer indicating how much product was sold. InvoiceDate a string indicating the date of the sale. The table prices is a column indicating the price of each product in the company's inventory and has four columns: StockCode a string indicating the product identifier (matching the identifiers in the table sales. Description a string describing the product. UnitPrice the price in USD of the product. (4 points) Bonus problem: Improving X Co Retail SOP a) Improve the ad-hoc method that X Co Retail employs to predict demand for a product in the next month. In particular, write a function so that if a product code and a target month (for example product code '71053' and month '2011-05') are provided, then a regression is done on the monthly total quantity sold for the 3 months before the target. (You may use the code provided in the Making the 'printout' slide of Lecture 05 as a starting point.) The function then returns a prediction for the target month, according to the OLS fit. Provide some short instructions on how to use your function, and examine plots for some product code/month pairs. Does your exploration suggest that rolling out this procedure on all product codes may be indicated? Why, or why not

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!