1. Seasonal / holiday / promotional effects
Of course, prices are not the only thing that could influence demand! Let's talk about demand changing due to season, holiday, or promotion.
2. Influencers of Demand
Maybe your products are seasonal in nature. Winter coats would be an example of this. You can buy them any time of the year, but certain seasons have highers sales.
Speaking of certain times of year, one special case of these would be holiday effects. Retail sales around Thanksgiving and Christmas, candy around Halloween, fireworks around the 4th of July. There are expected bumps in sales, regardless of price, during these times.
Of course, companies try to control and influence non-price bumps in sales through promotions as well! Whether they market to consumers directly or through placement in stores, companies try to influence demand.
3. Seasonal / Holiday / Promotion?
We can plot sales to see if there are any signs of spikes in sales that might be from seasonal, holiday, or promotion effects. Of course, we already saw that sales directly depend on price so we better plot price also to make sure that these spikes we see here don't correspond to drops in price. Hmm... Its hard to tell.
4. Sales and Price
Even if we put these graphs on top of each other with some extra plotting options not shown here, it becomes difficult to really see if spikes are a result of price changes or due to other things. We need to test them!
5. Linear Regression! Again...
Linear regression can help us answer this question too! Regression is used to determine if there is a relationship between demand and many factors all at the same time. If these effects are statistically significant, AKA not due to random chance, then our product demand changes on more than just price. It is especially helpful to add these effects in WITH price. That way we can see if we have any seasonal, holiday, or promotion effects AFTER taking price into account.
6. Creating Effects Example
Let's create some binary factors that will represent the effects we are trying to test. The company says that they expect sales to be higher for their products around Valentine's Day, so let's create a valentine factor.
First we create a series of 3 dates; the weeks before Valentine's Day in the training data set. We then make it into an xts object with only 1 for values created by the repeat function. We repeat 1, three times.
Next we do the same thing with a series of dates across the whole training data set. We then merge these two objects, the xts object with the valentine dates along with the training data set dates. Notice the last option we have, fill = 0.
This will fill the empty dates (the non-valentine's day dates) with 0's. Neat trick huh?
7. Adding Effects Example
Now let's add this valentine variable to our linear regression model of log of price predicting log of demand! Using the summary function on this model object we can see if sales during the week leading up to Valentine's Day is significantly different. Based on our sample size here, let's use two stars to deem significant enough. In statistics we would say our significance level is 0.01. Looks like Valentine's Day is significantly higher because of the two stars and the positive estimate of 0.22942!
8. Let's practice!
I wonder if this holds true in the metropolitan region as well! Go explore and find out!