Neural Demand Estimation with Habit Formation and Rationality Constraints
Organizations: University of Cambridge
Abstract
We develop a flexible neural demand system for continuous budget allocation that estimates budget shares on the simplex by minimizing KL divergence. Shares are produced via a softmax of a state-dependent preference scorer and disciplined with regularity penalties (monotonicity, Slutsky symmetry) to support coherent comparative statics and welfare without imposing a parametric utility form. State dependence enters through a habit stock defined as an exponentially weighted moving average of past consumption. Simulations recover elasticities and welfare accurately and show sizable gains when habit formation is present. In our empirical application using Dominick's analgesics data, adding habit reduces out-of-sample error by c.33%, reshapes substitution patterns, and increases CV losses from a 10% ibuprofen price rise by about 15-16% relative to a static model. The code is available at https://github.com/martagrz/neural_demand_habit .
Figures & tables
| Model | CES |
|---|---|
| LA-AIDS | |
| BLP (IV) | |
| QUAIDS | |
| Series Estm. | |
| LD (Shared) | |
| LD (GoodSpec) |
| Model | |||
|---|---|---|---|
| LA-AIDS | |||
| BLP (IV) | |||
| QUAIDS | |||
| Series Estm. | |||
| Linear Demand (Shared) | |||
| Linear Demand (GoodSpec) |
| Model | CV | Error vs Truth (%) |
|---|---|---|
| LA-AIDS | 0.4% | |
| BLP (IV) | 1.7% | |
| QUAIDS | 0.4% | |
| Series Estm. | 0.2% | |
| Linear Demand (Shared) | 24.5% | |
| Linear Demand (GoodSpec) | 24.9% |
| Model | Quasilinear | Leontief | Stone–Geary | Endog. CES |
|---|---|---|---|---|
| LA-AIDS | ||||
| BLP (IV) | ||||
| QUAIDS | ||||
| Series Estm. | ||||
| LD (Shared) | ||||
| LD (GoodSpec) |
| Model | RMSE | KL Div. | RMSE Red. (%) |
|---|---|---|---|
| LA-AIDS | 0.0% | ||
| BLP (IV) | -3.2% | ||
| QUAIDS | 0.1% | ||
| Series Estm. | 1.6% | ||
| Linear Demand (Shared) | -222.0% | ||
| Linear Demand (GoodSpec) | -223.7% |
| Quantity | Value |
|---|---|
| True | 0.7 |
| (mean ± SE) | 0.680 ± 0.014 |
| IS lo (mean) | 0.487 |
| IS hi (mean) | 0.762 |
| IS width (mean±SE) | 0.276 ± 0.122 |
| Coverage (%) | 100 |
| Good | Mean Price | Std Price | Mean Share | Std Share |
|---|---|---|---|---|
| ($/100 tablets) | ||||
| Aspirin | 7.311 | 1.557 | 0.2107 | 0.0519 |
| Acetaminophen | 10.554 | 1.427 | 0.5026 | 0.0785 |
| Ibuprofen | 10.506 | 1.428 | 0.2867 | 0.0819 |
| Train: 28,644 obs Test: 4,287 obs Stores: 93 Weeks: 1–399 | ||||
| Model | RMSE | MAE |
|---|---|---|
| LA-AIDS | ||
| BLP (IV) | ||
| QUAIDS | ||
| Series Est. | ||
| Linear Demand (Shared) | ||
| Linear Demand (GoodSpec) |
| Model | (ASP) | (ACET) | (IBU) |
|---|---|---|---|
| LA-AIDS | |||
| BLP (IV) | |||
| QUAIDS | |||
| Series Est. | |||
| Linear Demand (Shared) | |||
| Linear Demand (GoodSpec) |
| Model | CV Loss ($) | vs Neural Demand (static) |
|---|---|---|
| LA-AIDS | +1.1% | |
| BLP (IV) | -8.2% | |
| QUAIDS | +0.8% | |
| Series Est. | -2.4% | |
| Linear Demand (Shared) | -19.6% | |
| Linear Demand (GoodSpec) | -19.6% |
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| Price equation | First-stage | First-stage | Partial |
|---|---|---|---|
| Aspirin | 43285.80 | 0.645 | 0.603 |
| Acetaminophen | 49300.16 | 0.664 | 0.633 |
| Ibuprofen | 35854.14 | 0.619 | 0.557 |
| Model | Test KL | |||||
|---|---|---|---|---|---|---|
| Static (no reg) | 0.0192 | 0.0499 | 0.5395 | 0.937 | 0.0027 | 0.0576 |
| Static (reg) | 0.0201 | 0.0353 | 0.4358 | 0.937 | 0.0019 | 0.0487 |
| Habit (no reg) | 0.0114 | 0.0157 | 0.2463 | 0.931 | 0.0004 | 0.0186 |
| Habit (reg) | 0.0113 | 0.0078 | 0.1279 | 0.930 | 0.0001 | 0.0109 |
| FE static (reg) | 0.0164 | 0.0438 | 0.2553 | 0.937 | 0.0043 | 0.0722 |
| FE habit (reg) | 0.0114 | 0.0107 | 0.1009 | 0.937 | 0.0003 | 0.0175 |
| Quantity | Value |
|---|---|
| mean ± SE) | 0.800 ± 0.000 |
| IS lo (mean) | 0.640 |
| IS hi (mean) | 0.900 |
| IS width (mean±SE) | 0.260 ± 0.024 |
| Model | CV Loss ($) | vs Neural Demand (static) |
|---|---|---|
| LA-AIDS | +2.3% | |
| BLP (IV) | +6.9% | |
| QUAIDS | +1.5% | |
| Series Est. | +1.8% | |
| Linear Demand (Shared) | -18.8% | |
| Linear Demand (GoodSpec) | -18.6% |
| Model | CV Loss ($) | vs Neural Demand (static) |
|---|---|---|
| LA-AIDS | -2.8% | |
| BLP (IV) | +7.3% | |
| QUAIDS | -2.2% | |
| Series Est. | +1.0% | |
| Linear Demand (Shared) | +10.2% | |
| Linear Demand (GoodSpec) | +10.1% |