For many retailers, setting the right price for their products is an important task for revenue management. However, retailers often face the challenging question of which price is optimal. While a product demand is usually responsive to changes in price, it is also affected by many other factors such as seasonality and competitor pricing. Being able to estimate the true effect of price changes on demand is the key to determining the optimal price of a product. In this blog, we illustrate how one can estimate the price elasticity of demand of a fictitious ice cream brand using the** **Actable AI’s Causal Inference module. All analysis results can be found here.

For illustration purposes, let us look at the historical sales of a fictitious ice cream brand offered by an online retailer. Our data set consists of one year of historical sales that includes both price and quantity sold. In this dataset, we assume that the demand is affected by day of week, month and price. Specifically, the ice cream demand for weekends is usually higher than weekdays. Furthermore, due to the increasing popularity of the brand, there is a small upward monthly trend in the demand, so that on average, February demand is slightly higher than January demand, March demand is slightly higher than February demand, and so on. Finally, it is also reasonable to assume that the customers are responsive to changes in price, so that an increase in price would lead to a reduction in demand, all else being equal. In generating this dataset, we assume that customers are in general less sensitive to price changes during weekends (Friday, Saturday and Sunday) than during weekdays.

For the historical price, we assume that it also has an upward monthly trend similar to the demand. Within each week, there is a markup during weekends, so that Friday, Saturday and Sunday on average have higher prices than the rest. This might be reasonable when the retailer accounts for increased cost in making and delivering the ice cream during weekends.

The Correlational Analysis results reflect the aforementioned assumptions that we used to synthesize the dataset. Interestingly, even though the unconstrained demand is in general higher during weekends, the actual observed sales is lower because the prices are usually higher during weekends.

Using Actable’s Time Series Forecasting tool, we could visualize the seasonal fluctuation of the ice cream demand. We could also see that the Time Series Forecasting module is able to pick up the demand patterns and produce a relatively reasonable forecast of demand for the next two months.

We saw in the previous section that the Time Series Forecasting module provides a prediction of what the future demand would be, based on the historical demand and price patterns. However, such a prediction is made merely based on statistical correlations between demand and price and seasonal factors. It doesn’t provide the answer to “how many percent reduction in demand if we increase the price by one percent, all else being equal”. The answer to such a question is related to the economics concept of the price elasticity of demand, and is an important input to price optimization. Estimating the price elasticity of demand is the same with estimating the causal effect of price on demand.

We will use Actable AI’s Causal Inference module to estimate the price elasticity of demand. For the analysis, we select “demand” as Outcome, “price” as Treatment. To estimate the elasticity by day of week, we also select “day_of_week” as Effect Modifier. Finally, we select “month” as Common Causes. Last but not least, we check the boxes Logarithmic Treatment and Logarithmic Outcome. The number of trials is set at the 8 trials. This parameter is used to decide the trade-off between the estimation accuracy and speed. In general, increasing the number of trials results in more accurate estimation of the causal effects, but also increases the duration of the analysis.

Due to the logarithmic transform of price and demand, the estimated causal effect of price on demand can be interpreted as the percentage changes in demand due to a percentage change in price, which is the exact definition of price elasticity of demand. Below is the screenshot of the settings and the corresponding causal graph. The nodes on this graph represent different variables in our dataset. The causal effect of interest is represented by the directed edge from “price” to “demand”. Both “day_of_week” and “month” are common causes, so there are directed edges connecting them with the “price” and “demand” nodes. The effect modifier node “day_of_week” is in blue color to highlight the fact that we are estimating the causal effect of price on demand by day of week.

After running the analysis, we got the below output from the Causal Inference module. In specific, the top plot shows the treatment effect, or the price elasticity of demand, by day of week, where Monday is encoded as 0, Tuesday is encoded as 1, and so on. The negative signs indicate that an increase in price results in a decrease in demand. For example, a percent increase in price on Monday will result in 1.8 percent decrease in demand on average. Furthermore, we can see that the customers are less price sensitive during weekends than during weekdays, an observation that agrees with our assumptions in generating the dataset.

Finally, the tree diagram provides a different way to interpret the results by grouping the effect modifier into different buckets and showing the average treatment effect within each bucket. This is useful when the range of values for the effect modifier is large.