✨
Premier Academic Publisher
Serving Researchers Since 2012

Price Elasticity of Demand and Dynamic Pricing in Online Retail: A Machine Learning Approach to Revenue Optimization

DOI : 10.5281/zenodo.23664166
Download Full-Text PDF Cite this Publication

Text Only Version

Price Elasticity of Demand and Dynamic Pricing in Online Retail: A Machine Learning Approach to Revenue Optimization

Harighanesh A and D. Senthilkumar*

sri venkateswara college of engineering

Abstract – Pricing is among the most powerful levers a retailer con- trols, yet many online retailers still set prices with fixed mark- ups. This paper measures how sensitive demand is to price and tests whether that sensitivity can guide better prices. Using weekly product-level transactions of a UK-based online retailer, price elas- ticity is estimated three ways: a log-log fixed-effects regression, a gradient-boosting demand model with counterfactual price pertur- bation, and double machine learning that adjusts for seasonality and product effects. Elasticity is then compared across price tiers and seasons, and a guard-railed dynamic pricing policy, limited to

±20% changes inside each products historical price range, is simu- lated on a chronological hold-out period. Results: the pooled elastic- ity is 3.24 (95% CI 3.74 to 2.73), so demand is strongly price- elastic, although volume discounts to wholesale customers probably exaggerate its size; double machine learning agrees (3.19) but the machine learning counterfactual does not (positive sign); gra-

dient boosting lowers forecast error (WAPE) by 16.8% against a historical-mean baseline; and the simulated pricing policy shows revenue gains of 77%, which are implausibly large and are read as artefacts of the estimated elasticity and the model, not as achievable gains. Implications, limits of observational price data and the need for controlled price experiments are discussed.

Index Terms Dynamic pricing, price elasticity of demand, rev- enue optimization, demand forecasting, gradient boosting, double machine learning, retail analytics.

NOMENCLATURE

  1. INTRODUCTION

    Online retail makes prices visible, comparable and easy to change. Two ideas sit at the centre of data-driven pricing: price elasticity of demand, the percentage change in quantity de-manded for a one percent change in price, and dynamic pricing, the adjustment of prices over time in response to demand, season, inventory or competition [1], [2]. When demand is elastic, a price cut raises revenue; when it is inelastic, a price rise does. Knowing which regime a product is in is therefore the foundation of any pricing decision.

    Many retailers hold years of transaction history but have never run pricing experiments. Estimating elasticity from such obser-vational data is difficult because prices are not set at random: they move with seasons, promotions and stock levels, which also move demand, so a naive regression of quantity on price can be biased and even give a positive elasticity. Machine learning mod-els, in contrast, forecast demand well but do not by themselves identify a trustworthy price response [3], [4].

    Related work in electricity retail has shown the value of learn-ing price response from data and then optimising prices under explicit limits. Ruan et al. [5] learn appliance-level consump-tion behaviour with graph attention networks and search for customised retail prices whose changes are bounded to hedge risk for both consumer and retailer. This paper follows a similar philosophy, learning price response first and optimising second under stated guard- rails, but in product retail, where data are transactions rather than smart-meter readings and where elas-ticity can be estimated with econometric and causal machine learning tools.

    The research questions are:

    i, t

    Qit , Pit

    i,

    xit

    Qit (P)

    eit

    P , P

    mm, inM max

    i i

    ci,

    Rit , it

    Product and week indices.

    Units sold and realised average price. Price elasticity of demand.

    Product effect and pooled elasticity in the log-log model. Calendar and trend controls (month, week of year, peak flag, time index).

    Units predicted by the machine learning model at price P. Counterfactual elasticity from the machine learning model. Double machine learning elasticity.

    PLroiwceesmt ualntdiphliiegrhaensdt ttrhaeinsientgopfrcicaendoifdpartoedmuuctltii.pliers.

    Assumed unit cost and its ratio to median price. Revenue and profit of product i in week t.

    RQ1. How elastic is demand for an online retailers products, and how much does it vary across products?

    RQ2. Does elasticity differ by price tier and by season?

    RQ3. Does a machine learning demand model forecast weekly

    demand better than a baseline and a linear log-log model?

    RQ4. Can a guard-railed pricing policy raise predicted revenue or profit relative to observed prices?

    The contributions are fourfold. (1) A reproducible pipeline from

    Results come from the authors run of the accompanying script on Online Retail II in Google Colab. Manuscript received October 23, 2026. The authors are with the Department of Artificial Intelligence and Data Science, Sri Venkateswara College of Engineering, Sriperumbudur, Chennai, India (e-mail: acm@svce.ac.in).

    raw transactions to pricing recommendations on open data.

    (2) Triangula n of elasticity with fixed-effects regression, ma-chine learning counterfactuals and double machine learning. (3) Segment- level evidence by price tier and season. (4) A pric-ing simulation with explicit constraints, cost sensitivity and an

    honest account of its limits.

    The rest of the paper is organised as follows. Section II gives preliminaries. Section III describes the data and Section IV the estimation framework. Section V defines the evaluation frame-work, and Section VI the guard-railed pricing model. Section VII presents numerical studies, and Section VIII concludes.

  2. PRELIMINARIES

    A. Price Elasticity of Demand

    For a product with price P and quantity Q, the own-price elastic-ity is

    realised price is revenue divided by units. Products are kept if they have at least 40 weeks of sales and a price coefficient of variation of at least 0.03, since elasticity cannot be identified for a product whose price never changes; the 150 highest-revenue products among these form the panel. Weeks without sales have no logarithm, so the analysis is conditional on positive sales.

    TABLE I

    Variables of the ProductWeek Panel

    Variable Definition

    = Q/Q ln Q,

    P/P ln P

    (1)

    Qit Pit

    ln Qit , ln Pit

    Units of product i sold in week t Revenue divided by units (GBP) Natural logarithms

    so a log-log demand model delivers directly as a slope. Meta-

    analyses of econometric studies report average elasticities well below

    1 and substantial variation by product type, data level and model [6], [7], which motivates product- and segment-level estimates rather than one industry average.

    Since revenue is R = PQ, its sensitivity to price is

    R

    Relative price Month, week of year Peak flag

    Time index Price tier

    C. Chronological Split

    Pit over the products median training price Calendar position of week t

    1 for OctoberDecember, else 0 Weeks since the first observation Tercile of the products median price

    P = Q (1 +), (2)

    which is negative when < 1 (cutting price raises revenue) and positive when 1 < < 0 (raising price raises revenue).

    B. Dynamic Pricing and Revenue Management

    Dynamic pricing was formalised as a control problem under inventory and time limits [8] and consolidated in standard texts [1],

    [2]; surveys stress the trade-offbetween exploiting current demand estimates and experimenting to learn them [9]. With constant elasticity < 1 and unit cost c, the profit-maximising price follows the classical mark-up rule

    The first 80% of weeks form the training set and the last 20% the test set; only products present in training are scored. Product base prices are computed from training weeks only to avoid look-ahead.

    1. Proposed Elasticity Estimation Framework

      Fig. 1 summarises the pipeline. Three estimators, labelled A, B and C in the subsections below and in the tables, are used because each fails in a different way, and agreement between them is more credible than any single estimate.

      Raw transactions (Online Retail II)

      Elasticity: A. fixed-effects log-log

      B. ML counterfactual C. double ML

      c

      P* = , (3)

      1+

      which shows why accurate elasticities matter: errors in trans-late directly into mispricing. Machine learning has been com-bined with price optimisation for an online flash-sales retailer [3], and algorithmic pricing is already widespread on large mar-ketplaces, raising transparency questions [10].

  3. DATA AND PROBLEM SETTING

  1. Dataset

    The Online Retail II dataset [11] contains transactions of a UK- based online retailer between December 2009 and December 2011. The firm mainly sells unique all-occasion gift-ware, and many customers are wholesalers. Each record holds an invoice number, stock code, description, quantity, invoice date, unit price (GBP), customer identifier and country.

  2. Cleaning and Aggregation

Cancelled invoices (numbers starting with C), rows with non- positive quantity or price, and non-product codes such as postage, manual adjustments and bank charges are removed. Transactions are then aggregated to the productweek level (Table I). The

Fig. 1. Framework of the proposed analysis pipeline.

  1. Log-Log Fixed-Effects Regression

    ln Qit = i + ln Pit +m(t) + t +it, (4)

    where i absorbs each products baseline popularity and price level, m(t) are month effects capturing seasonality, is a linear trend and is the pooled elasticity. Standard errors are clustered by product. Per- product regressions

    lnQt = a +blnPt +cpeakt +dt +ut (5)

    give the distribution of product-level elasticities (median, in- terquartile range and share significantly negative at the 5% level).

  2. Machine Learning Counterfactual Elasticity

    A histogram-based gradient boosting regressor [12], [13] predicts ln Qit from product identity, ln Pit, relative price, month, week of year, peak flag and time index. Let Q it (P) be the predicted units at price P. The

    Algorithm 1 Guard-Railed Grid-Search Pricing

    i i

    Require: Trained model Q, hold-out rows, M , [Pmin, Pmax], , objective J

    it

    Ensure: Multipliers m* and simulated changes 1:

    for each hold-out row (i,t) do

    it

    2: J* Jit (1), m* 1 [> observed price is a candidate

    counterfactual elasticity re-predicts each test row with the price raised by one percent:

    43::

    for Peach mmEin{Mm\a{x1{}mdPo, Pmin}, Pmax}

    e =

    l n Q it (1.01 Pit) ln Q it (Pit)

    it

    ln 1.01

    , (6)

    i i

    5: predict Qit (P); compute Rit (m), it (m) 6: if Jit (m) > J* then

    7: J* Jit (m), m* P/Pit

    8: end if

    and is averaged by product and overall.

  3. Double Machine Learning

    Following [14], consider the partially linear model

    ln Qit = ln Pit + g(zit) + uit, ln Pit = m(zit) + vit, (7) where zit holds the controls (product mean ln Q and ln P, month,

    week of year, peak flag, time index). Random forests estimate g

    9: end for

    10: end for

    11: return m*it, R%, %

    which keeps it inside the range of prices seen in training. Pre-dicted revenue and profit are

    it

    Rit(m) = P i(tm)Q it P (m) , (13)

    and m with 5-fold cross-fitting, giving residquals qit and vit. Then

    v2 u2

    vit qit it

    it(m) = Pit (m) ci Q it Pit (m) ,

    with the assumed unit cost ci = P¯i, where P¯i is the median

    (14)

    = v2 , s^e= v2 it , (8) training price and E {0.5, 0.6, 0.7} because the data contain

    it it

    with uit = qit vit. The controls cannot remove confounding

    by unobserved promotions or stock-outs, so is an adjusted, not randomised, estimate.

  4. Segment Analysis

Products are split into terciles of median price (low, mid, high) and weeks into peak (OctoberDecember) and off-peak. Estima-tor A is re-estimated within each segment.

no cost information. The pricing model is

m* = arg max Jit(m), M = {0.80, 0.85,…, 1.20}, (15)

it mEM

where Jit is either Rit or it. The ±20% cap is a deliberate guard-rail, comparable in spirit to bounding price changes to limit consumer and retailer risk in [5]. Simulated gains are measured against the models own prediction at the observed price, so the comparison isolates the policy from model error:

  1. Evaluation Framework

    R%

    = 100

    Rit(m*) (16)

    it 1

    ,

    R

    Forecast accuracy on the hold-out weeks uses, on the unit scale, MAE

    q

    1

    and % analogously.

    B. Algorithm

    it(1)

    = 1 |Q Q |,

    RMSE =

    (Q Q)2, (9)

    n n

    WAPE = |Q Q | , (10)

    Q

    and on the log scale

    Because Q comes from a tree ensemble, the problem has no closed form, and a grid search over the small set M is exact and fast (Algorithm 1).

    Rln2 = 1

    (ln Q ln Q )2

    . (11)

    A. Set Up

    VII. NUMERICAL STUDIES

    (ln Q ln Q) 2

    WAPE is preferred to percentage errors because weekly units of slow products are small and near-zero denominators make percentage errors unstable. Benchmarks are each products his-torical mean of ln Q in the training period and the fixed-effects regression. Elasticity estimates are also checked for sign, plausi-ble magnitude and agreement across estimators.

  2. Guard-Railed Dynamic Pricing Model

  1. Formulation

    For a hold-out product-week (i,t) and multiplier m applied to the observed price, the candidate price is

    Pit (m) = min{max{mPit, Pmin}, Pmax}, (12)

    i i

    All code is in Python with pandas, statsmodels, scikit-learn

    and matplotlib [15], [16]; the random seed is 42. The gradient boosting model uses learning rate 0.05, 400 iterations, maximum depth 6 and minimum leaf size 20; the double-ML forests use 150 trees with minimum leaf size 5. The panel contains 150 products and 13,885 product-weeks from 30 November 2009 to 5 December 2011, with mean weekly units 212.8, mean realised price 4.20 GBP and a mean within-product price coefficient of variation of 0.19. Experiments ran on a Google Colab cloud runtime (Python 3.13).

  2. Elasticity Estimates (RQ1)

    Table II reports the pooled estimates. The fixed-effects elasticity is 3.24 (95% CI 3.74 to 2.73), so a 10% price increase is

    associated with a fall of about 27% in weekly units. The double-ML estimate is 3.19, and the machine learning counterfactual averages

    +1.15. The fixed-effects and double-ML estimates agree closely and their intervals almost coincide, which supports

    the sign and rough size of the effect after adjusting for product, season and trend. The machine learning counterfactual disagrees and has the wrong sign: tree ensembles are piecewise constant, so a one percent price change rarely crosses a split, and price also acts as a proxy for product and season. The gadient boosting model is therefore used for forecasting and not as an elastic-ity estimator. At product level the median elasticity is 4.17

    (interquartile range 5.39 to 3.12), and 92% of products are significantly negative (Fig. 2 and Fig. 3). These magnitudes are

    larger than the averages typically reported in meta-analyses [6], [7]. A likely reason is that many customers are wholesalers who receive volume discounts, so weeks with very large orders have low average prices, which mechanically links low price to high quantity. The estimates are best read as upper bounds on price sensitivity.

    TABLE II

    Pooled Price Elasticity Estimates

    Method

    Elasticity

    95% CI

    n

    A. Fixed-effects log-log

    3.24

    [3.74, 2.73]

    13,885

    C. Double ML

    3.19

    [3.55, 2.84]

    13,885

    B. ML counterfactual

    +1.15

    n/a

    3,033

    Fig. 2. Relationship between ln P and ln Q after removing product means (simple slope

    3.09; one extreme price observation stretches the axis).

    Fig. 3. Distribution of product-level elasticities (median marked).

  3. Segments (RQ2)

    Table III compares price tiers and seasons. Point estimates are most elastic for mid-priced products (3.55) and least elastic for low- priced ones (2.56), and peak-season demand (3.01) is slightly less elastic than off-peak demand (3.24), which would fit gift buyers being less price-sensitive before Christmas.

    However, the confidence intervals overlap heavily (for example peak

    3.56 to 2.46 against off-peak 3.87 to 2.61), so the data do not show that price sensitivity differs significantly across tiers or seasons. The pattern is at most a hypothesis for future work.

    TABLE III

    Elasticity by Price Tier and Season

    Segment

    Elasticity

    SE

    n

    Price tier: low

    2.56

    0.45

    4,900

    Price tier: mid

    3.55

    0.28

    4,350

    Price tier: high

    3.31

    0.57

    4,635

    Season: peak (OctDec)

    3.01

    0.28

    3,601

    Season: off-peak

    3.24

    0.32

    10,284

  4. Forecast Accuracy (RQ3)

    Table IV gives hold-out accuracy. Gradient boosting lowers WAPE from 0.593 to 0.493 relative to the historical-mean base-line (a 16.8% reduction) and is the best model on every metric

    (MAE 108.6, RMSE 258.5, R2ln0.667)2. The fixed-effects log- log model reaches a higher log-scale R than the baseline (0.508 against 0.385) but a higher unit-scale error (WAPE 0.631), which may reflect back-transforming log predictions. Permutation im-portance (Fig. 4) shows that product identity matters most, fol-lowed by the two price features, relative price and log price, and then week of year; month, the peak flag and the time index add almost nothing once week of year is included. Because the two price features are correlated, the importance of each understates the joint effect of price.

    TABLE IV

    Hold-Out Forecast Performance

    Model

    MAE

    RMSE

    WAPE

    R2

    ln

    Product historical mean

    130.5

    292.0

    0.593

    0.385

    Fixed-effects log-log

    139.0

    338.0

    0.631

    0.508

    Gradient boosting

    108.6

    258.5

    0.493

    0.667

    Fig. 4. Permutation importance on the hold-out weeks.

  5. Pricing Simulation (RQ4)

    Table V reports simulated outcomes. The revenue-maximising policy changes predicted revenue by +76.7% and lowers prices in 89.5% of weeks and raises them in 5.5%. Profit-maximising policies change predicted profit by +40.4% to +56.2% across E {0.5, 0.6, 0.7}. The direction of the policy, mostly price cuts with an average multiplier below one, is the same for every cost ratio, while the size of the gain depends on . These gains are

    not credible as achievable results. They follow from an elasticity near

    3 taken at face value: with < 1 every price cut raises revenue, so the optimiser pushes prices toward the lower guard-rail, and for most product-weeks the simulated revenue change exceeds 40% (Fig. 5). The elasticity is probably overstated (Section VII-B), the tree model is noisy, and choosing the best of several candidate prices from a noisy model overstates gains. The figures are an upper bound that illustrates the method and not a forecast; only a controlled price experiment can show what a price cut would really do.

    TABLE V

    Simulated Pricing Policy Outcomes

    Objective

    R%

    %

    Avg. m

    Down/Up

    Revenue

    0.6

    +76.7

    +42.4

    0.88

    89.5/5.5

    Profit

    0.5

    +73.5

    +56.2

    0.90

    81.0/11.9

    Profit

    0.6

    +68.0

    +48.8

    0.92

    75.1/16.9

    Profit

    0.7

    +57.3

    +40.4

    0.95

    64.9/26.2

    Fig. 5. Distribution of simulated revenue change per product-week, clipped to

    [20, 40]%; most product-weeks sit at the upper limit.

  6. Discussion

Managerial implications. At face value the estimates say that most products are price-elastic, so targeted price cuts and pro-motions are worth testing, while the few inelastic products are candidates for margin protection. Because the estimated elas-ticities are probably inflated by volume discounts, cuts should be trialled on a small set of products first, and A/B price tests should confirm any gain before roll-out. Week- to-week changes should be capped, cost floors respected and prices kept inside the range the model has seen. Elasticities should be re-estimated periodically as assortment, competition and customer mix drift. Limitations. (i) The data are observational; unobserved pro- motions, stock-outs and competitor prices can bias estimates even with controls. (ii) Cost, promotion, competitor and inven-tory data are absent, so is an assumption. (iii) Weeks without sales are excluded, so estimates are conditional on positive sales.

(iv) Many customers are wholesalers, which limits transfer to consumer retail and, through volume discounts, probably in-flates the estimated elasticities. (v) Weekly prices are revenue-weighted averages that can mix discounts and bulk deals, so price and quantity are mechanically linked. (vi) Gains are simulated, and back-transforming log predictions slightly understates unit forecasts. (vii) A single temporal split is used; rolling-origin evaluation would be more reliable. (viii) The machine learn-ing counterfactual elasticity has the wrong sign, so the pricing simulation, which relies on the same model, is unreliable in size. Ethics. Dynamic pricing raises concerns about fairness, trans-parency and customer trust and may be regulated by consumer-protection law [10]. The policy here prices products over time

and does not personalise prices to individuals.

VIII. COCLUSION

This paper built a reproducible pipeline that estimates price elas-ticity with three complementary methods, compares demand forecasting models and simulates a guard-railed dynamic pricing policy on open retail data. Demand for the retailers products is

strongly price-elastic (pooled elasticity about 3.2, with fixed-effects regression and double machine learning agreeing), al-though volume discounting probably exaggerates the magnitude. Gradient boosting forecasts weekly demand 16.8% better than a historical-mean baseline in WAPE, but its counterfactual price re-sponse has the wrong sign, so forecasting accuracy and elasticity estimation should be treated as separate tasks. Differences across price tiers and seasons are not statistically distinguishable. The

simulated pricing gains are very large and should be read as an upper bound produced by the elasticity estimate, not as achiev-able improvements. Future work includes randomised price experiments, richer controls for promotions and competition, hierarchical Bayesian elasticity models that share information across products, explainability with SHAP [17], stock-aware optimisation, and bandit-based pricing that learns while it earns.

ACKNOWLEDGMENT

Harighanesh A thanks D. Senthilkumar, Department of Artificial Intelligence and Data Science, Sri Venkateswara College of En- gineering, for his guidance, supervision and feedback throughout this work. The authors also thank the donor and maintainers of the Online Retail II dataset and the UCI Machine Learning Repository for making the data publicly available.

Data and code availability. The Online Retail II dataset is publicly available from the UCI Machine Learning Repository [11]. The analysis script used to produce all tables and figures is available from the authors on request.

Use of AI tools. Anthropics Claude was used to assist with drafting and editing the manuscript and with writing the analysis code and LATEX source. The authors executed the analysis on the public dataset and take full responsibility for the content of the

paper.

2001.

  1. J. Ruan et al., Graph deep-learning-based retail dynamic pricing for demand response, IEEE Trans. Smart Grid, vol. 14, no. 6, pp. 4385 4397, Nov. 2023, doi: 10.1109/TSG.2023.3258605.

  2. G. J. Tellis, The price elasticity of selective demand: A meta-analysis of econometric models of sales, J. Marketing Res., vol. 25, no. 4, pp. 331 341, 1988.

  3. T. H. A. Bijmolt, H. J. van Heerde, and R. G. M. Pieters, New empirical generalizations on the determinants of price elasticity, J. Marketing Res., vol. 42, no. 2, pp. 141156, 2005.

  4. G. Gallego and G. van Ryzin, Optimal dynamic pricing of inventories with stochastic demand over finite horizons, Manage. Sci., vol. 40, no. 8,

    pp. 9991020, 1994.

  5. A. V. den Boer, Dynamic pricing and learning: Historical origins, current research, and new directions, Surv. Oper. Res. Manage. Sci., vol. 20, no. 1,

    pp. 118, 2015.

  6. L. Chen, A. Mislove, and C. Wilson, An empirical analysis of algorithmic pricing on Amazon Marketplace, in Proc. 25th Int. Conf. World Wide Web, 2016, pp. 13391349.

  7. D. Chen, Online Retail II, UCI Machine Learning Repository, 2019.

    [Dataset].

  8. G. Ke et al., LightGBM: A highly efficient gradient boosting decision

    tree, in Proc. Adv. Neural Inf. Process. Syst., vol. 30, 2017.

  9. F. Pedregosa et al., Scikit-learn: Machine learning in Python, J. Mach. Learn. Res., vol. 12, pp. 28252830, 2011.

  10. V. Chernozhukov et al., Double/debiased machine learning for treatment and structural parameters, Econometrics J., vol. 21, no. 1, pp. C1C68, 2018.

  11. S. Seabold and J. Perktold, Statsmodels: Econometric and statistical modeling with Python, in Proc. 9th Python Sci. Conf., 2010.

  12. W. McKinney, Data structures for statistical computing in Python, in

    Proc. 9th Python Sci. Conf., 2010.

  13. S. M. Lundberg and S.-I. Lee, A unified approach to interpreting model

predictions, in Proc. Adv. Neural Inf. Process. Syst., vol. 30, 2017.

REFERENCES

  1. K. T. Talluri and G. J. van Ryzin, The Theory and Practice of Revenue Management. New York, NY, USA: Springer, 2004.

  2. R. L. Phillips, Pricing and Revenue Optimization. Stanford, CA, USA: Stanford Univ. Press, 2005.

  3. K. J. Ferreira, B. H. A. Lee, and D. Simchi-Levi, Analytics for an online retailer: Demand forecasting and price optimization, Manuf. Serv. Oper. Manage., vol. 18, no. 1, pp. 6988, 2016.

  4. L. Breiman, Random forests, Mach. Learn., vol. 45, no. 1, pp. 532,

Harighanesh A is a final-year B.Tech. student in Artificial Intelligence and Data Science at Sri Venkateswara College of Engineering, Sriperumbudur, Chennai, India. He has completed internships as a Data Analysis intern at Mitochondrion Info Tech Pvt Ltd (JulyAugust 2026) and as an AI intern at Codework AI, where his projects included retail demand forecasting with seasonal feature engineering and Random Forest models, credit card fraud detection, sales prediction and sentiment analysis. He is also a Business Analyst intern at MD Smart Advisory (AugustNovember 2026). His research interests include business analytics, pricing and demand forecasting.