cat ~/projects/econometric-modeling-demand-analysis/README.md

Econometric Demand Analysis

Demand function estimation for train travel. Market segmentation and dynamic pricing via econometric modeling.

Pythonpushed 2mo ago
Transport EconomicsEconometric ModelingPrice ElasticityMarket SegmentationRevenue OptimizationNational rail demand datasetSolo Developer
signal.overview

How much does a 10% price increase reduce train ridership? The answer depends entirely on who's riding. Business commuters barely flinch; leisure travelers switch to buses. This project estimates segment-specific demand functions for train travel using econometric methods, then uses those functions to find revenue-maximizing prices.

The core model is a log-linear demand function estimated via OLS and 2SLS (to handle price endogeneity). Separate elasticity estimates for four market segments — business travelers, leisure, commuters, and students — reveal dramatically different price sensitivities. The business segment is almost perfectly inelastic; the student segment is elastic enough that price cuts actually increase revenue.

The pricing optimization layer takes these estimated elasticities and computes the revenue-maximizing price for each segment, subject to capacity constraints. The result is a dynamic pricing matrix that a rail operator could implement directly.

run.simulation()
econometric-modeling-demand-analysis — interactive demo
Less elasticMore elastic
demand & revenue curves — Business Traveler
Optimal Price
$250
Projected Demand
330
Projected Revenue
$82,500
Elasticity Regime
Inelastic
revenue heatmap — all segments × price points
Segment$20$40$60$80$100$120$150$180$220
Business Traveler
26K
36K
43K
49K
55K
59K
66K
71K
78K
Leisure
218K
121K
86K
67K
56K
48K
39K
34K
28K
Commuter
153K
169K
180K
188K
194K
200K
206K
212K
218K
Student
340K
108K
56K
35K
24K
18K
12K
9K
7K
cat ARCHITECTURE.md
PythonstatsmodelsscipypandasMatplotlibSeaborn
  • Estimation pipeline: data cleaning → instrument selection → 2SLS estimation → elasticity extraction → revenue optimization.
  • Endogeneity handled via instrumental variables (fuel prices, competitor fares) to get causal price elasticity estimates.
  • Revenue optimization uses constrained nonlinear programming (scipy.optimize.minimize) with capacity bounds.
© 2026 Om Gorakhiasys.uptime: ∞