The world’s leading publication for data science, AI, and ML professionals.

Identifying your Price Competitors with Cross-Price Elasticities – A Practical Approach

Identifying who are your price competitors is key for price and promotion allocation

Hands-on Tutorials

Photo by Nicolas Hoizey on Unsplash
Photo by Nicolas Hoizey on Unsplash

One of the most important things when you are setting a price or a promotion, it is to know with whom are you competing to, what other product or products promotions does affect our product sales. In other words, when other products have a discount in their prices, how much these discounts affect our product sales.

In this post, we will explore and identify the nature of price competition between products such as Starbucks coffee vs Juan Valdez coffee or when products are likely to be price complements such as tomato sauce and pasta by calculating cross-price elasticities using multiple linear regression in Python. As usual, this post is all inclusive; I would give you a brief and easy explanation of cross price elasticities and share a very easy to follow code with you that explains step by step an example case of Laptop cross-price elasticities in the e-commerce industry.

We would be able to explore the following:

"When somebody else changes their price, what happens to my demand?"

Calculating cross-price elasticities is similar to price elasticities but with a little bit of a twist, while basic price elasticities explains the sales demand changes of our product when we increase or decrease same product prices; it is calculated as following:

Image 1 by Author
Image 1 by Author

Cross-price elasticities explains the sales demand changes of our product, when other products prices increase or decrease. In other words, it explains the influence of other product price changes towards our product sales demand; it is calculated as following:

Image 2 by Author
Image 2 by Author

Cross-price elasticities allow us to identify price competitors/substitutes and complements. I would explain further these two definitions by taking the examples mentioned above for price competitors such as Starbucks coffee vs Juan Valdez and price complements such as tomato sauce and pasta.

Competitor/substitutes:

Let’s say that Starbucks coffee beans and Juan Valdez coffee beans are strong competitors and consumers are price conscious and usually juggling between the choices of selecting one over the other. In this case, what is likely to happen is that when Starbucks coffee beans are on discount, the quantity sold of Juan Valdez coffee beans will decrease because the consumers would have a price preference on Starbucks that has a cheaper price and Juan Valdez sales will be affected.

As a result, this would give us the following positive cross-price correlation:

When Starbucks coffee price decreases, Juan Valdez coffee quantity sold decreases

Photo by Mockup Graphics on Unsplash
Photo by Mockup Graphics on Unsplash

Complements:

Let’s say that a consumer is shopping and see the tomato sauce on discount, hence the consumer is more likely to buy pasta in order to cook a fabulous spaghetti "yummy!". This is when we identify that the products are complemental, when one product price decreases, the consumer is likely to buy the other product in conjunction in order to complement it; such as the tomato sauce and pasta.

As a result, this would give us the following negative cross-price correlation:

When tomato sauce price decreases, spaghetti quantity sold increase

Photo by Danijela Prijovic on Unsplash
Photo by Danijela Prijovic on Unsplash

After all, how we can identify price competitors or price complements?

Great question!

Following, I would go through the complete step-by-step code process and provide you a very easy to follow explanation of what data is needed and how you can interpret cross-price elasticities results using multiple linear regression. Hurray, let’s begin the fun part!


Data Collection:

What data to collect?

For analyzing cross-price elasticities, we need to have one or more price changes from a possible competitor or many possible competitors and our product sales demand (quantity sold) during the same timeframe that the competitor price changes occurred in order to be able to observe our sales demand reaction towards the product price changes from the competitor or competitors.

In this case, this model would focus more on price competitors/substitutes than price complements due that we are focusing on the product prices of one sole category "Laptop, Computer". If we would like to analyze further to price complements, then ideally we would add laptop components such as laptop bags, laptop cases, external hard drives and others.

Python Libraries used are:

We would use following python libraries: pandas, numpy, matplotlib and statsmodels.

Here, I imported pandas, numpy and matplotlib on the beginning but in the following steps you will see the most important from all, which it is statsmodels used mainly for the Multiple Linear Regression model.

Table 1 by Author
Table 1 by Author

Data Frame Features explained:

_Date_imp: Date time impression when the data was captured_

_Category_name: Category name is a feature included in order to analyze prices in sole groups such as Laptops, Speakers and others_

name: Name of the product

_disc_price: Price of the product with the discount already deducted_

merchant: merchant is the platform that the product is located

condition: product condition. As a recommendation, analyze product prices from the same condition. Otherwise, this might affect your results due that product prices with condition as "used" are usually cheaper than new product prices

_Sales_count: sales count is the sales demand of the products with their respective prices_

From the data, only the merchant called "Bestjam.com" was selected in order to not have any incongruences. It might be that other merchants have more user traffic (market share), different consumer segmentation and as a result product quantity sold can vary from merchant to merchant.

For the reasons mentioned above, data is filtered by "Bestjam.com" e-commerce platform, "Laptop, Computer" category and condition of the product as "New".

Data Preparation:

In a Multiple Linear Regression, we want to rightfully allocate the independent and dependent variables. When we talk about independent and dependent variables , you can think of them as the cause and effect: an independent variable is the variable you think is the cause, while a dependent variable is the effect.

As we know, price elasticity and cross-price elasticities formulas are very similar with just a little twist. Price elasticity measures the likelihood of how sensitive the product Y quantity sold is towards product Y price changes, in other words it measures the likelihood of the demand changes towards its own product price changes, while cross-price elasticities measures the likelihood of how sensitive the product Y demand (quantity sold) is towards product (Z,M,W) competitor price changes.

Price Elasticity = (x : yellow, y : yellow)

Product Y Price and Product Y Quantity Sold

Cross-Price Elasticities = (x: gray, y: yellow)

Product Price (Z,M,W) and Product Y Quantity Sold

Chart 1 by Author
Chart 1 by Author

For cross-price elasticities, we would set the price of possible competitors as independent variables (x values) and the quantity sold of our product as dependent variable (y value). The competitor price changes and quantity sold needs to be aligned along the same timeframe in order to be able to observe the likelihood of our product quantity sold being affected by competitor product price changes.

In this case, we would analyze the cross-price elasticity of ASUS VivoBook laptop. Following, we can observe that we have in our data frame multiple laptop price changes from multiple products that were displayed in the "Bestjam.com" e-commerce website, including ASUS VivoBook prices and quantity sold.

Table 2 by Author
Table 2 by Author

We set laptop prices as x values (independent values) and ASUS VivoBook quantity sold as y value (dependent value).

Perfect, now that we have our data ready to be seeded in the multilinear regression model.It is time to jump to the coolest part of our cross-Price Analysis, multilinear regression model.

Cross-Price Elasticity Model Formula:

As we might know, cross-price calculation is the following:

Image 3 by Author
Image 3 by Author

which it is rewritten in the use of Multiple Linear Regression as follows;

Cross Price Elasticity of Demand in Multilinear Regression:

*Coefficient (Slope) Price Mean of Product B / Quantity Mean of Product A**

In simple words the coefficient(slope) is the Coefficient of Product Price B and Quantity Sold of Product A

We calculate the price mean of our x values (Laptop prices) and the quantity sold mean of our y value (ASUS VivoBook quantity) in order to seeded in our cross-price elasticity formula later.

Once we have the mean for our cross-price elasticity formula. We would calculate the coefficients, as follows:

We import statsmodels library in python for our multilinear regression and fit our model, as follows:

Great, we almost there. As you can see below under coef, these are the coefficients that we would use for our cross-price elasticities formula.

In order to analyze the statistical significance of our coefficients, it is important to observe coefficient p-value and t (t-stats)

t_score: equals to t-stats, which indicates the significance of the findings. The closer is to 0, the more likely there is no significance. The greater the t-stats, whether positive or negative, the greater the significance of the findings

coefficient_pvalue: tests the null hypothesis that the coefficient is equal to zero (no effect). A low pvalue (< 0.05) indicates that you can reject the null hypothesis

Image 4 by Author
Image 4 by Author

This is amazing, now we have what we need to calculate our cross-price elasticities, and we learned which coefficients might be significant and which ones we should drop from our analysis. Further, we would seed all our calculations to our cross-price formula and magic, we would get our cross-price elasticities.

Congratulations coming this far, now that we have our cross-price elasticities, I would explain you further how to interpret the results :).

Data Visualization: Divergent Plot for Cross-Price Elasticities

As a bonus, I am adding a data visualization function that it would help you to present your cross-price elasticities and how you can interpret the data from your visualization 🙂

Above, this built-in function would help you for the visualization of cross-price elasticities. For further analysis, divergent plot is used because it gives the reader a more clear overview between negative and positive cross-price elasticities for price analysis.

Cross-Price Elasticity Results

When we have positive cross-price elasticities, it means that these products are substitutes or main competitors in pricing. In other words from our sample data, we can observe that the main competitors of ASUS VivoBook (our product) are Apple MacBook Pro, Dell XPS and Ali. This means that when the prices from these competitor products drop, our product demand or sales drop as well due that the customers are more likely to tradeoff our product with these competitor product. These learnings from cross-price elasticities are key for our promotion strategies, we are able to identify which competitor products have the biggest influence in our demand and as a result we can strategically keep a watch on key competitors for our future price strategies.

Graph 2 by Author
Graph 2 by Author

If Apple MacBook Pro decrease their price by 10%, ASUS VivoBook quantity sold (our product) is likely to decrease by 130.56%, and so on.

Now you got it, you are ready to build your own cross-price elasticity models and use data for your price strategies.

References:

Cost and Economics in Pricing Strategy, University of Virginia

Thanks for reading!


Related Articles