This research is to find out whether promotional activities give better results than no promotional activities and how much it effects to purchase probability.
Analyzing Price Elasticity Against Purchase Probability
1. Step By Step Analyzing Price Elasticity
With Feature Promotion Against Purchase Probability
By Rahmat Taufiq Sigit
INTRODUCTION
One of marketing activities that very important is promoting. Product or Services are introduced to
the market by promitional activities. So the main goal of promotional activites is so that products or
services are known by the market and in increase sales.
Because of this very important promotion objective, companies need a lot of money to make
promotional successful. However, this also make the company have to do some research to
determine what kind of promoition strategy can be used.
Price elasticity means how much the probability of purchase for the product or services to the price
increment. On this occasion, we will discuss step by step analyzing product prices against purchase
probabilities with promotional features.
This research is to find out whether promotional activities give better results than no promotional
activities and how much it effects to purchase probability.
The source of this research data comes from the minimarket transaction database. And the product
that will be discussed is chocolate bar. So let’s begin
DATASET
Variable Data type Range Description
ID numerical Integer Shows a unique identificator of a customer.
Day numerical Integer Day when the customer has visited the store
Incidence categorical {0,1} Purchase Incidence
0 The customer has not purchased an item from the category of interest
1 The customer has purchased an item from the category of interest
Brand categorical {0,1,2,3,4,5} Shows which brand the customer has purchased
0 No brand was purchased
1,2,3,4,5 Brand ID
Quantity numerical integer Number of items bought by the customer from the product category of interest
Last_Inc_Brand categorical {0,1,2,3,4,5} Shows which brand the customer has purchased on their previous store visit
0 No brand was purchased
1,2,3,4,5 Brand ID
Last_Inc_Quantity numerical integer
Number of items bought by the customer from the product category of interest during
their previous store visit
Price_1 numerical real Price of an item from Brand 1 on a particular day
Price_2 numerical real Price of an item from Brand 2 on a particular day
Price_3 numerical real Price of an item from Brand 3 on a particular day
Price_4 numerical real Price of an item from Brand 4 on a particular day
Price_5 numerical real Price of an item from Brand 5 on a particular day
Promotion_1 categorical {0,1} Indicator whether Brand 1 was on promotion or not on a particular day
0 There is no promotion
1 There is promotion
Promotion_2 categorical {0,1} Indicator of whether Brand 2 was on promotion or not on a particular day
0 There is no promotion
1 There is promotion
Promotion_3 categorical {0,1} Indicator of whether Brand 3 was on promotion or not on a particular day
0 There is no promotion
1 There is promotion
Promotion_4 categorical {0,1} Indicator of whether Brand 4 was on promotion or not on a particular day
0 There is no promotion
1 There is promotion
Promotion_5 categorical {0,1} Indicator of whether Brand 5 was on promotion or not on a particular day
0 There is no promotion
1 There is promotion
Sex categorical {0,1}
Biological sex (gender) of a customer. In this dataset there are only 2 different
options.
0 male
1 female
Marital status categorical {0,1} Marital status of a customer.
0 single
1 non-single (divorced / separated / married / widowed)
Age numerical Integer
The age of the customer in years, calculated as current year minus the year of birth of
the customer at the time of creation of the dataset
18 Min value (the lowest age observed in the dataset)
75 Max value (the highest age observed in the dataset)
Education categorical {0,1,2,3} Level of education of the customer
0 other / unknown
1 high school
2 university
3 graduate school
Income numerical real Self-reported annual income in US dollars of the customer.
38247 Min value (the lowest income observed in the dataset)
309364 Max value (the highest income observed in the dataset)
Occupation categorical {0,1,2} Category of occupation of the customer.
0 unemployed / unskilled
1 skilled employee / official
2 management / self-employed / highly qualified employee / officer
Settlement size categorical {0,1,2} The size of the city that the customer lives in.
0 small city
1 mid-sized city
2 big city
2. In Dataset structure there are 24 coulumn (feature), however, not all of the feature will be used.
These features are Incidence, Price_1, Price_2, Price_3, Price_4, Price_5, Promotion_1,
Promotion_2, Promotion_3, Promotion_4, Promotion_5
IMPORT PACKAGES
import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression
import matplotlib.pyplot as plt
import matplotlib.axes as axs
import seaborn as sns
sns.set()
The codes above are used to import library that will be neded in data processing.
LOAD DATASET
Next step is accessing the dataset from data folder with these codes below
df_purchase = pd.read_csv("data/purchase data.csv")
df_pa=df_purchase
PRICE CHANGES SIMULATION
This step is try to make dummy price dataset. This data will be used in linier regression model.
Before that, let’s do some descriptive analyzing the price dataset.
df_pa[['Price_1','Price_2','Price_3','Price_4','Price_5']].describe()
the result of the code above, can be seen in the image below :
The image above shows the price dataset has 5.8693 rows, minimum prices is $1,1 anda max price is
$2,8.
After knowing the min and max price, then lets create a dummy price range with approximately the
same ratio using codes below:
price_range = np.arange(0.5,3.5,0.01)
price_range
the price range dataset is set with a minimum value is 0.5 and maximal value is 5.0 with 0.1
increament. Value 0,1 of increament is to make the dummy dataset that can describe the movement
of price and pribability in every $0,1.
and the result can be seen in the image below:
3. Put the dummy price to a dataframe with these codes below:
df_price_elasticities = pd.DataFrame(price_range)
Rename the first feature of data df_price_elasticities from 0 to “Price Range” and display the
dataframe using codes below
df_price_elasticities = df_price_elasticities.rename({0:'Price Range'}, axis=1)
df_price_elasticities
The result of the codes above are below:
DETERMINE X AND Y VALUE FOR LINIER REGRESSION MODEL
This research using 3 feature, the features are price, promotion against probability of purchase. So
the algorithm that will be used is multinomial linier regression, which has two X values (Factors). X
value is price and promotion and Y value is incidence.
The code below is to determine Y value:
Y = df_pa['Incidence']
The codes below are used to define mean of price as X1 and mean of promotion as X2. And safe both
of X into dataframe named X
X = pd.DataFrame()
X['Mean_price'] = (df_pa['Price_1']+
df_pa['Price_2']+
4. df_pa['Price_3']+
df_pa['Price_4']+
df_pa['Price_5']
)/5
X['Mean_promotion'] = (df_pa['Promotion_1']+
df_pa['Promotion_2']+
df_pa['Promotion_3']+
df_pa['Promotion_4']+
df_pa['Promotion_5']
)/5
X
The result of the codes above are below:
MODEL ESTIMATION
Define the multinomial linier reggression using these codes below:
model_incidence_promotions = LogisticRegression(solver='sag')
model_incidence_promotions.fit(X,Y)
model_incidence_promotions.coef_
And the koefisien result are :
array([[-1.49403391, 0.56165343]])
Koefisien of price is -1,4 it means that price and purchase have a negatif relation, which is purchase
probability increase if the price decrees. Otherwise, Promotion is positif relation with 0,56 koefisien
value. the model quantified the exact relation between price, promotion and purchase probability
CALCULATE PRICE ELASTICITY WITH PROMOTION
First step of this phase is to make new dataframe with first column (feature) is price range using
these codes below:
df_price_elasticities_promotion=pd.DataFrame(price_range)
df_price_elasticities_promotion=df_price_elasticities_promotion.rename({0:'Price
Range'}, axis=1)
Second step is to add new column named promotion with 1 value. By using these code below:
df_price_elasticities_promotion['promotion']=1
df_price_elasticities_promotion
The Result can be seen in the picture below:
5. The third step is to predict the promotion of Y using the estimated model that has been made before
using the codes below:
Y_promotion=model_incidence_promotions.predict_proba(df_price_elasticities_promotio
n)
The Result can be seen in the picture below:
The result if Y predict promotion is second column.
The forth step for this phase is to calculate the price elasticity and store it to dataset called
df_price_elasticities, by using these codes below:
promo = Y_promotion[:,1]
pe_promo= model_incidence_promotions.coef_[:,0]*price_range*(1-promo)
df_price_elasticities['elasticity_promo_1']=pe_promo
CALCULATE PRICE ELASTICITY WITH NO PROMOTION
First step of this phase is to make new dataframe with first column (feature) is price range using
these codes below:
df_price_elasticities_no_promotion = pd.DataFrame(price_range)
df_price_elasticities_no_promotion =
df_price_elasticities_no_promotion.rename({0:'Price Range'}, axis=1)
Second step is to add new column named no_promotion with 0 value. By using these code below:
df_price_elasticities_no_promotion['no_promotion']=0
df_price_elasticities_no_promotion
6. The Result can be seen in the picture below:
The third step is to predict the no promotion of Y using the estimated model that has been made
before using the codes below:
Y_no_promotion=model_incidence_promotions.predict_proba(df_price_elasticities_no_pr
omotion)
The forth step for this phase is to calculate the price elasticity and store it to dataset called
df_price_elasticities, by using these codes below:
no_promo = Y_no_promotion[:,1]
pe_no_promo= model_incidence_promotions.coef_[:,0]*price_range*(1-no_promo)
df_price_elasticities['elasticity_no_promo']=pe_no_promo
df_price_elasticities
The Result of price elasticity for promotion can be seen in the picture below:
The Result of price elasticity for no promotion can be seen in the picture below:
7. If the value is above 100% (>1), it means that the probability is elastic, and if the value is below 100%
(<1), it means the probability is inelastic.
Comparing Promotion Vs No Promotion
The last phase is to make graph and describe data clearly using codes below:
plt.figure(figsize=(9,6))
plt.plot(price_range,pe_promo, color='grey')
plt.plot(price_range,pe_no_promo, color='green')
plt.legend(['Promotion', 'No Promotion'])
plt.xlabel('Price')
plt.ylabel('Elasticities')
plt.title('Price Elasticities With Promo and No Promo to Purchase Probability')
The Result can be seen in the picture below:
The price elasticity of the Promotion is $1.46 with pruchase probability 1.002 and Non Promotion
$1.27 with a purchase probability level of 1.003. It can be seen that there is a price difference of
around $0.2. Price sensitivity decreases when there is a promotion. The conclusion is the chocolate
bar product price can be increased to maximal $0,2 if the product followed by promotion feature.
Increasing chocolate bar price above $0,2, purchase probability will go decrease.
And It would be better to have high original prices with consistent promotions than low original
prices but no promotions.