Workflow, Validation, and Reference
By this chapter, every model in the book has been laid out. But when you actually sit down to write a structural paper, what trips you up is usually not any single step of algebra; it is how to organize the whole enterprise, and which links you cannot afford to cut corners on. This chapter reduces everything that came before into a workflow you can follow and a set of tools you can reach for. The earlier chapters walked from logit to BLP and dynamic choice along $(F,G)$, saying which kind of question each class of model is best at answering; this chapter adds no new model and does just two closing things. The first half (9.1 and 9.2) strings these models into a working pipeline that runs from the research question to a finished paper: modeling, identification, estimation, validation, all the way through to the writing. The second half (9.3 through 9.7) organizes the core formulas, software, notation, and common failures from every chapter into quick-reference tables. When it is worth reaching for structure and how to walk the decision tree: the guiding rules were settled in Chapter 02 and the decision tree was given in Chapter 01, so this chapter does not repeat those arguments and simply carries the judgment through to concrete operations.
The illustrative example that runs through the chapter is still the book's standard video-subscription setup: a user chooses among general-interest platform A, general-interest platform B, niche documentary platform C, and not subscribing (the outside option, with utility normalized to 0). The parameters are $\beta_{\text{price}}=-0.1$, $\beta_{\text{ad}}=-0.05$, $\beta_{\text{content}}=0.8$, $\text{ASC}_C=0.3$, which give $V_A=-0.90$, $V_B=-1.11$, $V_C=-2.44$, and baseline choice probabilities of about $P_A=22.30\%$, $P_B=18.07\%$, $P_C=4.78\%$, $P_{\text{out}}=54.85\%$. illustrative data
9.1 Seven Steps from Research Question to Model
The most common way a structural paper fails is not an error in some step of the algebra; it is running the whole pipeline in the wrong order: first falling for an elegant model, then casting about for a question it can answer. That route almost never works, because a model is meant to serve the question, not the other way around. The right order is exactly the reverse, and we walk it here in seven steps. The first five are design and estimation; the sixth, validation, gets its own treatment in section 9.2; the seventh lands on the counterfactual and its presentation. Each step first says what to do, then flags where you are most likely to trip. Step 4, identification, is the most abstract and the easiest to get tangled in, so it comes with a template you can fill in and one worked-out example.
Step 1: Write down the counterfactual
Before you touch anything, write down in a sentence or two the counterfactual you want to evaluate, then ask yourself one question: does this really require a structural model? The rule was given in Chapter 02: if the counterfactual sits inside the range of variation the data have already seen (price did move within this interval, and you care only about the average effect within it), then design-based methods are usually more robust and less work. Only when the counterfactual steps outside the support of the data (a brand-new price point, a mechanism that never appeared, a market structure that has changed shape), or when the study itself calls for decomposing mechanisms or computing welfare numbers, does the extra cost of a full structural model pay for itself.
A structural method is never an end in itself. Before you use one, answer a question honestly: where exactly does the reduced form fall short, and what identification or policy payoff does the added structural complexity buy back? If you cannot answer that, do not rush to reach for structure. And many counterfactuals are only thought experiments on paper; the question worth pressing is who it matters to, and whether some decision-maker would actually act on it.
Step 2: Define the agent, the choice set, and the time granularity
To translate a still-fuzzy question into a model you can estimate, pin down three things: who is choosing (a consumer, a seller, or both sides), within which set the choice is made (does it include the outside option, is the consideration set smaller than the full set), and what the time unit of the decision is (each session, a monthly subscription cycle, or each purchase). The 12 modeling decisions in Chapter 02 are the complete list; here we give only a short checklist to get you started.
Who is the decision-maker? Where is the boundary of the choice set drawn, and does it include the outside option? Do the time granularity and the data frequency line up? Is it a one-shot choice (static) or is there a switching cost or learning (dynamic, Chapter 07)? At which level does heterogeneity enter (none, observed interactions, random coefficients)? The distributional assumption $G$ determines the substitution pattern, so think it through before picking a model.
If there is no way to know which options the user actually saw (the exposure set of a recommendation algorithm is unobserved), a discrete choice model loses its footing; you should settle choice-set identification before talking about estimation (Chapter 08). Another hazard is treating “the result of past choices” as an exogenous control: cumulative usage and the current subscription tier are both products of earlier decisions, correlated with unobserved preferences, so you must either model the state's evolution explicitly (Chapter 07) or handle the initial-conditions problem.
Step 3: Specify utility and heterogeneity
Utility specifications line up on a ladder from simple to complex (Chapter 04): at the bottom is standard logit (no unobserved heterogeneity, bound by IIA), and above it, in order, nested logit (within-nest correlation), mixed logit (random coefficients), and latent class (discrete types). Every rung you climb needs its own justification: either an IIA test is rejected, or the substitution pattern is plainly implausible, or the research question itself calls for characterizing the distribution of preferences. Complexity is not free: it eats identifying power and compute, and it crowds out the time you could have spent on sensitivity analysis.
The safe approach is to estimate a baseline logit first, get the coefficients and the fit, then add heterogeneity one rung at a time, comparing as you go. If the variance of a mixed logit's random coefficient comes back near 0, the data are telling you that the heterogeneity you assumed is not actually there. Falling back to a fixed coefficient is then both more honest and better identified.
Step 4: The identification argument
A word of reassurance first: identification is the most abstract stretch in the book, and finding it convoluted on a first pass is entirely normal, so we take it one step at a time. Estimating a set of coefficients is not the same as identifying them. Suppose an estimation returns a price coefficient of $\beta_{\text{price}}=-0.1$ with a large $t$ statistic, and you are ready to write “the price coefficient is significantly negative, identification done.” But a large $t$ value only says the number was estimated precisely; it does not answer a prior question: does this $-0.1$ measure the effect of price itself on choice, or has something else slipped in wearing price's clothing? Identification and precision are two different things, and identification comes first. Identification asks whether, even with infinite data, the variation in the data is enough to pick each parameter out from every competing explanation (Chapter 02, section 2.6).
To avoid missing hazards like this, break the identification argument into three interlocking questions and put each one, in turn, to every parameter you want to estimate:
- ① What exactly are you trying to estimate? State in one sentence the quantity this parameter represents in the model and which elasticity or counterfactual it ultimately supports.
- ② Which variation in the data identifies it? Point to the specific dimension of movement that identifies it: price levels differing across markets, repeated choices by the same individual, shares rising and falling with attributes.
- ③ When does identification fail, and what then? Write down the threats that would contaminate this dimension of variation, say which direction the estimate would be biased if a threat materialized, and give a remedy.
An identification map in an applied paper is, at bottom, one row of answers to these three questions for each key parameter, assembled into a table. Let us fill in the price-coefficient row in full first.
$\beta_{\text{price}}$ measures how much an option's utility falls for every one-yuan rise in the monthly fee. It directly supports the own-price elasticity: in the illustrative setup $\eta_{AA}=-2.33$, that is, a 1% increase in platform A's monthly fee lowers its share by about 2.33%. Every price-increase counterfactual that follows rests on this elasticity.
Different platforms in different periods charge different monthly fees while ads and ratings are broadly comparable; it is precisely this spread in price levels that identifies $\beta_{\text{price}}$. Picture the opposite extreme: if every platform charged exactly the same monthly fee, this column could not be filled in, the price coefficient would be beyond reach, and no sample size, however large, would help. This is exactly what it means to say identification has nothing to do with sample size.
The threat is that platforms with a higher monthly fee tend also to have higher unobserved quality $\xi_j$ (exclusive series that are not in the data). The price gap then has a quality gap mixed into it, the two are bundled together, $\beta_{\text{price}}$ is pushed toward zero, demand looks less sensitive than it truly is, and the naive approach of running logit directly on observed prices fails here. The remedy is to find an instrument that moves price without moving $\xi_j$ (a cost shifter or competitors' prices) and peel off the exogenous part of price; the ideal is a pricing experiment the platform ran itself (Chapters 06 and 08).
Going deeper: why contamination pushes the price coefficient toward zero
With price as the only regressor, it carries two opposing forces at once. A price increase lowers utility on its own, and that force is negative; but a price increase also comes with higher unobserved quality, which raises utility, and that force is positive. The two forces offset in estimation, the absolute value of the price coefficient is compressed and shrinks toward zero, and in severe cases even turns positive. The direction is definite: as long as $\text{Cov}(p_j,\xi_j)>0$, untreated endogeneity always makes demand look less sensitive than it truly is. This is the same mechanism by which the price coefficient is pushed toward zero in the OLS share regression of Chapter 06.
Apply this row's recipe to every key parameter and you get the ready-to-use template below. Its four columns line up exactly with the three questions just asked: the parameter is ①, “the variation it relies on” is ②, and “potential threat” plus “remedy” together are ③. Beyond the price coefficient from the illustrative setup, we fill one row each for a few parameters from the BLP setting.
| Key parameter | Variation it relies on | Potential threat | Remedy |
|---|---|---|---|
| $\beta_{\text{price}}$ price sensitivity | Exogenous variation in price across markets/time | Price correlated with unobserved quality $\xi_j$ | Cost-shifter or competitor IV; better still, the platform's own pricing experiment (Chapters 06 and 08) |
| $\lambda_k$ nesting parameter | Strength of within-nest substitution relative to across-nest substitution | A misspecified nesting structure that places dissimilar options in one nest | Report robustness under alternative nesting structures; constrain $\lambda_k\in(0,1]$ (Chapter 04) |
| $\sigma$ random-coefficient standard deviation | Repeated choices by the same individual, or shares covarying with attributes | Too short a panel or too few markets leaves $\sigma$ nearly unidentified | Add draws and markets; use Halton sequences; run a parameter-recovery self-check first (Chapter 05) |
| $\text{ASC}$ / $\xi_j$ | An option's fixed share level | Collinear with attributes, so the level cannot be separated from the slope | Normalize the outside option's utility to 0; initialize with the Berry inversion (Chapters 02 and 06) |
The most insidious failure is when column ② should come up empty but the model quietly supplies the answer through its own functional form. If a parameter is “identified” purely by a distributional assumption or a nonlinearity, with no corresponding variation in the data behind it, then it was assumed into existence, not identified by the data. The exclusion restrictions in a structural model should face the same scrutiny as the instruments in an IV study, and should not be buried in a footnote (Chapter 02, section 2.6).
In one sentence: the job of the identification section is to answer these three questions in turn for every parameter you want to estimate; the row where column ② (which variation identifies it) cannot be filled in is the first place the whole paper will be breached.
Step 5: Estimation, diagnostics, and robustness
The estimation stage has two disciplines, one about convergence and one about robustness, and neither can be skipped.
- Discipline one, numerical convergence. Diagnostics must match the estimator and the optimizer: gradient-based smooth maximum likelihood should check the first-order conditions, the objective value, and the curvature; methods with a line search usually require the accepted step to improve the objective, but not every optimizer's internal iterations are monotone. GMM should check the moment conditions, the objective value, and the gradient, rather than mechanically demanding a negative-definite Hessian. Multiple starting values converging to the same solution can only strengthen confidence in a global solution, not prove global optimality; BLP additionally requires checking the tolerances of the inner and outer loops separately.
- Discipline two, robustness. A conclusion cannot rest on a single specification. Lay out the perturbations in a matrix, change only one dimension per row, and watch whether the core parameters and the policy conclusion move with it.
The template for a robustness matrix follows; each row is a “change only one dimension” perturbation.
| Perturbation dimension | Baseline specification | Alternative specification | What to watch |
|---|---|---|---|
| Distributional assumption $G$ | logit | nested, probit, mixed | Stability of substitution patterns and welfare numbers |
| Nesting structure | Group by category | Group by price tier, by brand | $\lambda_k$ and the sign of cross-elasticities |
| Number of simulation draws $R$ | $R=200$ | $R=500$, $R=1000$ | Whether simulation noise has been absorbed and estimates are stable |
| Instrument set | Competitor prices | Cost-shifter IV, subset IV | Coefficient drift, first-stage strength, Hansen J |
| Subsample | Full sample | Split by market size, period, category | Coefficient heterogeneity, whether the conclusion is driven by one slice |
A robustness table is not an optional routine listing; its value is as a diagnostic. If switching the distributional assumption changes elasticities several-fold, that says the conclusion actually rests on $G$; you should then chase the reason and judge which specification is more credible, rather than declaring the job done once two columns of numbers sit side by side.
Step 6: Validation
Even after estimation has converged and the robustness matrix is filled in, the model can still be wrong. Convergence only guarantees you found an extremum of the objective function, and robustness only says the conclusion does not capsize under small changes to the specification; neither answers a more fundamental question: can the model predict data it never saw during estimation? The step that answers precisely this question is validation. It is the core of a structural paper's credibility, and section 9.2 spells out how to do it.
Step 7: Counterfactual and reporting
Only at the final step do you actually produce the counterfactual and report the results clearly. Three judgments must be spelled out here: whether to re-solve the equilibrium (once a counterfactual changes firms' optimal prices or products, the supply side must re-equilibrate, Chapter 06); how to report uncertainty (a point estimate cannot be given bare; attach a confidence interval or standard error); and on what basis to compute welfare (the simple closed-form logsum comes from additive Type I extreme-value errors; under mixed logit you integrate the individual- or draw-conditional logsum a second time. Monetizing utility with a constant marginal utility of price also requires ignoring income effects or explicitly adopting the corresponding approximation. Report the $\Delta CS$ before and after the policy, not an absolute level that depends on the normalization of the utility origin).
Assuming that firms do not change prices, enter, or exit in the counterfactual is often more misleading than the reduced form. An equally common error is to report the absolute value of $CS$: it depends on the normalization of the outside option and has no economic meaning in itself; only the before-and-after difference $\Delta CS$ can be interpreted.
Once the seven steps are done and the study is written up, the main text usually converges into four escalating parts: model, identification, estimation, counterfactual. The model part sets out the utility specification, the agent, the choice set, and the distributional assumption, that is, the five slots of $M(Y,X,\varepsilon;F,G)=0$; the identification part gives the identification map, explaining one by one the variation each key parameter relies on, the threats it faces, and the remedies; the estimation part reports the estimator, the convergence diagnostics, and the robustness matrix, after which validation carries enough weight that it usually becomes its own section covering all three layers (section 9.2); the counterfactual part presents the policy experiment, whether the equilibrium is re-solved, and the welfare basis and uncertainty intervals. These four parts roughly correspond to the seven steps above, except that validation is usually broken out of estimation into its own section. Write them all thoroughly and most methodological objections will be dissolved before the reader ever raises them.
To close 9.1, the table below gathers the methodological points most often pressed across the book's chapters into an index: each entry lists a one-sentence handling and the chapter where it lives, and it can serve as a pre-submission self-check, item by item, of whether the manuscript has already addressed each one.
| Methodological point | Handling (one-sentence skeleton) | See |
|---|---|---|
| The necessity of a structural method | Write down a counterfactual that exceeds the variation in the data, falling under one of the three legitimate reasons: ex-ante evaluation, mechanism decomposition, welfare computation; then validate with a slice of experimental variation. | Chapter 02 |
| Does identification come from the data or the functional form | Give an identification map, flag which conclusions are sensitive to the functional form, and report Monte Carlo recovery and robustness under alternative distributions. | 2.6, 9.1, 9.2 |
| Handling IIA | First judge whether IIA is really a problem in the specific application; if so, switch to nested or mixed, and report the Hausman-McFadden test and the substitution-pattern matrix. | Chapters 02, 03, 04 |
| Handling price endogeneity | Use BLP's $\delta$ decomposition together with cost-shifter/competitor IV; report the first-stage F, the Hansen J, and IV-versus-non-IV coefficient comparisons. | Chapter 06 |
| Conditions for consumer surplus to hold | The logsum requires Type I extreme value and no income effects; report only $\Delta CS$, not the absolute level; under mixed logit it must be computed by simulation. | Chapters 02, 08 |
| Endogenous choice sets (personalized recommendation) | Model the consideration set, or use platform randomization to fix the display set; acknowledge the scope of inference and run sensitivity to the choice-set definition. | Chapter 08 |
| Identifying network effects in two-sided markets | Find an exogenous shifter that affects only one side as an IV; note that platform fixed effects absorb the network-effect signal and drive a zero estimate. | Chapter 08 |
| The necessity of a dynamic model | Adopt one only when the research question involves forward-looking motives or switching costs and the static and dynamic models give different answers; it requires a long enough panel. | Chapter 07 |
| The credibility of a counterfactual | Confirm that parameters are not extrapolated, that the supply side re-solves equilibrium, and report confidence intervals; ideally validate ex post with a held-out experimental arm. | 07, 9.2 |
| Computing standard errors | Use the sandwich estimator for likelihood-based estimators and the GMM formula for GMM (BLP); cluster when there is within-market correlation. | 3.7, 6.6, 9.6 |
9.2 A Model-Validation Playbook
A model that fits well is not the same as a model you can trust. However pretty the in-sample fit, it only says the model has enough degrees of freedom to hug the data in hand; it says nothing about how the model holds up on new data (see Chapter 02, section 2.8, for the related discussion). This section breaks validation into three escalating layers of operation, then discusses one approach unique to platform data, and finally gives a “what to do when validation fails” diagnostic tree.
Three layers of validation
Layer one, in-sample grouped fit. Do not fixate on the overall goodness of fit; line up predicted shares against observed shares cell by cell across subgroups. Walk through it with the video-subscription setup: simulate 6000 choice scenarios from the true parameters (monthly fee, ad minutes, and content rating all carry variation), estimate a correctly specified logit by MLE, and compare each option's average predicted share against its observed share. illustrative data
| Subgroup | Observed share | Model-predicted share | Difference (predicted − observed) |
|---|---|---|---|
| Platform A | 23.02% | 23.10% | +0.08 pp |
| Platform B | 19.72% | 19.58% | −0.14 pp |
| Platform C | 5.50% | 5.50% | 0.00 pp |
| Not subscribing (outside) | 51.77% | 51.82% | +0.05 pp |
A correctly specified model hugs every subgroup to within 0.14 percentage points. The converse does not hold: a good fit does not let you conclude the model is right, especially when you are only watching the totals. The counterexample below makes the point in full.
Hand the same data to a misspecified model that leaves out content rating. It shows no crack at all in the totals: platform C's overall share still lands near 5.5%, matching the observed value almost exactly. But slice the scenarios by content rating and the problem appears at once. In the scenarios where C's rating is higher, the actual share choosing C is 6.58% while the model gives only 5.52%, underpredicting by 1.06 percentage points; in the scenarios where C's rating is lower, the actual share is only 4.40% while the model reports 5.48%, overpredicting by 1.08 percentage points. illustrative data The root cause is that the misspecified model never wrote content rating into utility, so it cannot tell high-rating scenarios from low-rating ones and can only give the same prediction for all of them. The two directional biases, one positive and one negative, cancel exactly in the total, dressing up a long-misspecified model as a perfect fit.
Layer two, out-of-sample holdout. Hold back part of the data during estimation, then have the model predict it afterward. How exactly you split depends on which kind of extrapolation you want to test:
- Split by time: estimate on the earlier periods, predict the later ones, and test whether parameters drift over time.
- Split by market: hold out several cities from estimation, predict their shares, and test cross-market extrapolation.
- Split by experimental arm: in a multi-arm experiment, one arm goes into estimation and another is kept for validation. Randomization guarantees that the holdout population and the estimation population share the same distribution, so of the three splits this one adds the fewest extra assumptions about extrapolation.
Layer three, parameter-recovery Monte Carlo. Let the model simulate a batch of data from itself, then see whether the estimation routine can recover the true parameters intact. It cannot prove identification in real data, and it will not necessarily distinguish weak identification from a coding error; what it can test is whether, under the researcher's chosen DGP, sample design, and numerical tolerances, the whole estimation routine shows systematic bias, wrong standard errors, or an obvious numerical failure. The core logic fits in six lines, and it is really a single self-addressed question: I know the true answer, so does my routine compute its way back to it?
for b in 1..B:
theta_true = fixed true parameters
data_b = simulate(model, theta_true, seed=b) # generate data from the DGP
theta_hat = estimate(model, data_b) # run the estimation routine
record(theta_hat, se_hat)
# check: mean(theta_hat) ≈ theta_true (unbiased), and 95% interval coverage ≈ 95%
The true parameters are $\beta_{\text{price}}=-0.10$, $\beta_{\text{ad}}=-0.05$, $\beta_{\text{content}}=0.80$, $\text{ASC}_C=0.30$. Generate $N=6000$ choice scenarios; in each scenario the three platforms' monthly fee, ad minutes, and content rating carry a normal perturbation on top of their baseline values (to produce the variation needed to identify the slopes), and the outside option's utility is fixed at 0. Each individual adds an i.i.d. Type I extreme-value shock to every option and then chooses the option with the highest utility.
Run MLE on the simulated data, with standard errors from the inverse of the numerical Hessian. All four parameters land within one standard error of their true values:
| Parameter | True value | Estimate | Standard error |
|---|---|---|---|
| $\beta_{\text{price}}$ | −0.100 | −0.0969 | 0.0036 |
| $\beta_{\text{ad}}$ | −0.050 | −0.0491 | 0.0031 |
| $\beta_{\text{content}}$ | 0.800 | 0.7703 | 0.0311 |
| $\text{ASC}_C$ | 0.300 | 0.2767 | 0.0778 |
The bias in a single estimation may be nothing but sampling fluctuation. Repeat the whole procedure 200 times and examine whether the mean of the estimates equals the true value and whether the 95% confidence interval's coverage is near 95%:
| Parameter | True value | Mean over 200 | Bias | 95% coverage |
|---|---|---|---|---|
| $\beta_{\text{price}}$ | −0.100 | −0.0998 | +0.0002 | 96.0% |
| $\beta_{\text{ad}}$ | −0.050 | −0.0501 | −0.0001 | 95.0% |
| $\beta_{\text{content}}$ | 0.800 | 0.7990 | −0.0010 | 94.5% |
| $\text{ASC}_C$ | 0.300 | 0.2957 | −0.0043 | 94.0% |
The Monte Carlo bias of all four parameters stays within 0.005, and coverage falls between 94% and 96%: under this one DGP, sample size, and number of repetitions, no obvious finite-sample bias or interval-coverage error shows up. This is not a proof of strict unbiasedness. If coverage systematically departs from 95%, check the standard-error formula, the optimization tolerance, the boundary parameters, and the model specification together; if the mean systematically departs from the true value, distinguish among finite-sample bias, weak identification, simulation error, and a coding error rather than pinning the cause on any one of them directly.
Platform data: using historical A/B tests as a holdout
The historical A/B tests a platform researcher has on hand are a rare, high-quality resource for validating a structural model. Randomization guarantees that the treatment and control groups share the same distribution, so you can use it this way: estimate the model on historical observational data (or the experiment's control group) alone, seal off an entire treatment arm, then predict the key metrics on that arm and compare against the experiment's measured values. Four points in particular:
- Which data to estimate on: the control group, plus historical variation not involving the intervention under validation. The model must never see any information from the treatment arm.
- Which data to seal off: hold out at least one full treatment arm. Multi-arm experiments are especially suited to this, with one arm for estimation and one for validation.
- Which metric to predict: predict quantities on the treatment arm that can be compared directly against the experiment, such as shares, conversion rates, or renewal rates, rather than the model's internal utilities.
- How to report the discrepancy: report the predicted value, the measured value, and the direction and magnitude of their difference. A large gap does not necessarily mean the model is wrong; it may be that the validation population differs, or that an aggregate shock outside the model occurred in the interim, so write out the possible sources together.
When validation fails, do not rush to swap models. First locate which subgroup the bias falls in, then trace it back to which model component went wrong:
- If the bias concentrates in a particular attribute dimension (say, options with high content ratings systematically deviate), check how that attribute enters utility: the functional form (linear or log), whether there is an interaction term, and whether the attribute was omitted (compare the content-rating misspecification example above).
- If the bias concentrates in substitution among certain classes of options (shares flow in a counterintuitive way after one option is removed), IIA is most likely at work, and you need to upgrade to nested or mixed logit (Chapter 04).
- If the bias concentrates in a particular price range or in high-priced options, usually price endogeneity was not fully treated, or a random price coefficient is needed (Chapters 04 and 06).
- If the bias concentrates in a stretch of time (predictions worsen the later it gets), parameters are drifting, and you may need a dynamic model or to allow time heterogeneity (Chapter 07).
- If the bias is uniform across the board and in one direction, it is often a definitional problem with the outside-option share or the market size, and you should return to the data-preparation stage.
9.3 Formula Quick Reference
The formulas are organized by model, one small table per block. They match the main text of each chapter. See section 9.5 for an index of the notation.
The Logit/Nested/Mixed blocks follow the convention of the main text in Chapters 02 through 05: $V_{nj}=\beta'x_{nj}$, the price coefficient $\beta_{\text{price}}<0$ enters utility directly, and the marginal utility of income is written $\alpha\equiv-\beta_{\text{price}}>0$. The BLP block follows the convention of Chapter 06: $\delta=x_j'\bar\beta-\bar\alpha p_j+\xi_j$, where $\bar\alpha>0$ denotes the magnitude of the price disutility. Under both conventions, the own-price elasticity is negative and the cross-price elasticity is positive.
Logit illustrative data
| Quantity | Formula | Notes |
|---|---|---|
| Choice probability | $P_{nj}=\dfrac{e^{V_{nj}}}{\sum_{k}e^{V_{nk}}}$ | with the outside option's $V_{n0}=0$, the denominator contains a term $e^{0}=1$ |
| Own-price elasticity | $\eta_{jj}=\beta_{\text{price}}\,p_j\,(1-P_j)$ | $<0$; in the illustration $\eta_{AA}=-2.33$ |
| Cross-price elasticity | $\eta_{jk}=-\beta_{\text{price}}\,p_k\,P_k$ | $>0$, and independent of $j$ (a fingerprint of IIA); in the illustration $\eta_{B,p_A}=0.669$ |
| logsum consumer surplus | $E[CS_n]=\dfrac{1}{\alpha}\ln\!\big(\sum_{k}e^{V_{nk}}\big)+C$ | $\alpha=-\beta_{\text{price}}$; the quantity after taking the expectation over $\varepsilon$; this holds only under Type I extreme value and no income effects ($\alpha$ treated as constant), and with income effects use the compensating variation instead (Chapter 08); only $\Delta CS$ is interpretable (Williams 1977; Small & Rosen 1981) |
| Log-likelihood | $LL=\sum_n\sum_j y_{nj}\ln P_{nj}$ | $y_{nj}=1$ when $n$ chooses $j$ |
| IIA property | $\dfrac{P_{ni}}{P_{nj}}=\dfrac{e^{V_{ni}}}{e^{V_{nj}}}$ | the ratio is independent of any third option, the hallmark of logit and also its limitation |
Nested Logit
| Quantity | Formula | Notes |
|---|---|---|
| Within-nest conditional probability | $P_{n j\mid B_k}=\dfrac{e^{V_{nj}/\lambda_k}}{\sum_{i\in B_k}e^{V_{ni}/\lambda_k}}$ | $j\in B_k$ |
| inclusive value | $I_{nk}=\ln\sum_{i\in B_k}e^{V_{ni}/\lambda_k}$ | the “bundled utility” of nest $k$ |
| Marginal probability of choosing a nest | $P_{n B_k}=\dfrac{e^{\lambda_k I_{nk}}}{\sum_{l}e^{\lambda_l I_{nl}}}$ | |
| Joint probability | $P_{nj}=P_{n j\mid B_k}\cdot P_{n B_k}$ | choose the nest first, then within the nest |
| $\lambda$ constraint | $\lambda_k\in(0,1]$ | within-nest correlation strengthens as $\lambda_k$ decreases ($1-\lambda_k$ is often used as a directional gauge); $\lambda_k=1$ collapses to logit |
Mixed Logit
| Quantity | Formula | Notes |
|---|---|---|
| Mixed probability (integral definition) | $P_{nj}=\displaystyle\int \frac{e^{V_{nj}(\beta)}}{\sum_k e^{V_{nk}(\beta)}}\,f(\beta\mid\theta)\,d\beta$ | integrated over the distribution of the random coefficient $\beta$, generally without a closed form |
| Simulated probability | $\hat P_{nj}=\dfrac{1}{R}\sum_{r=1}^{R} L_{nj}(\beta^{(r)})$ | $\beta^{(r)}$ drawn from $f(\cdot\mid\theta)$; start with $R$ from 500 to 1000, use Halton, and report doubling robustness |
| Panel joint probability | $\hat P_{n}=\dfrac{1}{R}\sum_{r=1}^{R}\prod_{t}L_{n y_{nt}}(\beta^{(r)})$ | the same individual's $\beta^r$ is shared across periods, jointly identifying heterogeneity |
| Simulated log-likelihood | $SLL=\sum_n\ln\hat P_{n,y_n}$ | the objective function after replacing the integral with the simulated probability |
BLP
| Quantity | Formula | Notes |
|---|---|---|
| Utility decomposition | $\delta_{jm}=x_{jm}'\bar\beta-\bar\alpha p_{jm}+\xi_{jm}$ | $\delta$ is the mean utility, $\xi$ is unobserved quality |
| Contraction mapping (inner loop) | $\delta^{t+1}=\delta^{t}+\ln S_{jm}-\ln\hat S_{jm}(\delta^{t})$ | $S$ is the observed share, $\hat S$ the predicted share; initialize from the Berry inversion |
| Berry inversion (logit case) | $\ln S_{jm}-\ln S_{0m}=\delta_{jm}$ | under homogeneous logit, shares are linear in $\delta$, the first step of estimation |
| Moment condition | $\mathbb{E}[\xi_{jm}\,Z_{jm}]=0$ | the instruments are orthogonal to unobserved quality |
| GMM objective | $\hat\theta=\arg\min_\theta\ \xi(\theta)'ZWZ'\xi(\theta)$ | $W$ is the weighting matrix; when overidentified, use the two-step optimal weight |
Dynamic discrete choice (Type I extreme-value case)
| Quantity | Formula | Notes |
|---|---|---|
| Bellman equation | $V(x,\varepsilon)=\displaystyle\max_d\big\{u(x,d)+\varepsilon_d+\beta\,\mathbb{E}[V(x',\varepsilon')\mid x,d]\big\}$ | here $\beta$ is the discount factor (the Chapter 07 convention), and the utility parameters are written $\theta$, not the preference vector used elsewhere in this table |
| Choice-specific value | $v_d(x)=u(x,d)+\beta\,\mathbb{E}[\bar V(x')\mid x,d]$ | the part that excludes the current shock $\varepsilon_d$ |
| Expected value (logsum form) | $\bar V(x)=\ln\sum_d e^{v_d(x)}+\gamma$ | $\gamma$ is Euler's constant; $\bar V$ is the integrated value function (the ex-ante value), equal to the logsum plus $\gamma$ |
| Choice probability | $P(d\mid x)=\dfrac{e^{v_d(x)}}{\sum_{d'}e^{v_{d'}(x)}}$ | the same structure as static logit, only with utility replaced by value |
| CCP inversion (Hotz-Miller) | $\bar V(x)-v_d(x)=\gamma-\ln P(d\mid x)$ | recover the value difference directly from observed CCPs, avoiding repeated Bellman solves; equivalent to the differenced form of Chapter 07, $v_d-v_0=\ln P(d\mid x)-\ln P(0\mid x)$ |
9.4 Software Reference
The table below is organized by task rather than by software. The first principle in choosing a package is ecosystem consistency over single-point functionality: keeping estimation, counterfactuals, and plotting in one language is safer and less error-prone than shuttling data across three languages for one particular feature.
| Task | Python | R | Stata |
|---|---|---|---|
| Conditional/multinomial logit | xlogit, pylogit | mlogit | clogit, asclogit, cmclogit |
| Nested logit | pylogit | mlogit, apollo | nlogit |
| Mixed logit | xlogit, pylogit | mlogit, apollo, gmnl, mixl | mixlogit, cmmixlogit |
| BLP | pyblp | BLPestimatoR | No mature package; usually hand-coded |
| Dynamic discrete choice | Usually hand-coded | Usually hand-coded | Usually hand-coded |
| Welfare/consumer surplus | Hand-coded (or pyblp built-in) | Hand-coded | Hand-coded |
The division of labor among the three Python packages needs to be kept straight: xlogit focuses on multinomial and mixed logit, uses GPU acceleration, and is far faster than traditional implementations on large samples, but it does not implement nested logit; when you need nested, switch to pylogit within Python. pyblp is the de facto standard for differentiated-products demand estimation, with built-in methods for both counterfactuals and elasticities. Dynamic models still have few off-the-shelf packages, and the state space and value-function iteration usually have to be implemented yourself.
PyBLP: the most common calls
import pyblp, numpy as np
problem = pyblp.Problem(
product_formulations=(
pyblp.Formulation('0 + prices + x1 + x2', absorb='C(product_ids)'), # linear part (absorb product fixed effects, drop the intercept to avoid collinearity)
pyblp.Formulation('0 + prices + x1')), # random-coefficient part
product_data=product_data, # must contain market_ids, shares, prices, and instrument columns
integration=pyblp.Integration('product', size=5)) # random coefficients require an integration config (or pass agent_data instead)
results = problem.solve(
sigma=np.eye(2) * 0.5, # initial values for the random coefficients
optimization=pyblp.Optimization('l-bfgs-b', {'gtol': 1e-5}),
iteration=pyblp.Iteration('squarem', {'atol': 1e-14})) # inner-loop contraction
elast = results.compute_elasticities() # elasticity matrix
cs = results.compute_consumer_surpluses() # consumer surplus
xlogit: the most common calls (mixed logit)
from xlogit import MixedLogit
model = MixedLogit()
model.fit(
X=df[['price', 'ad', 'content']], # long-format design matrix
y=df['choice'],
varnames=['price', 'ad', 'content'],
alts=df['alt'], ids=df['chid'], # option and choice-situation indices
randvars={'price': 'n', 'content': 'n'}, # monthly fee and content rating as normal random coefficients
n_draws=500, halton=True) # Halton draws
model.summary()
9.5 Notation
Notation used throughout the book. Local special usages are noted in place in each chapter.
| Symbol | Meaning | Type |
|---|---|---|
| $n$ | Index of the decision-maker (consumer) | Index |
| $j,\ i$ | Index of options/alternatives | Index |
| $m,\ t$ | Market/time index | Index |
| $U_{nj}$ | Total utility $=V_{nj}+\varepsilon_{nj}$ | Utility |
| $V_{nj}$ | Deterministic (systematic) utility | Observed part |
| $\varepsilon_{nj}$ | Random utility shock (Type I extreme value for logit) | Unobserved random |
| $\beta$ | Vector of preference parameters | To estimate |
| $\beta$ | Discount factor (a local usage in the Chapter 07 dynamic model, usually fixed rather than estimated) | Set by the researcher |
| $\alpha$ | Price-related coefficient: under the BLP convention $\bar\alpha>0$ is the magnitude of the price disutility; under the logit convention $\alpha=-\beta_{\text{price}}$ is the marginal utility of income | To estimate |
| $p_j$ | Price of option $j$ | Observed |
| $x_j$ | Vector of observed attributes of option $j$ | Observed |
| $\xi_j$ | Unobserved product quality (BLP) | Unobserved |
| $\delta_{jm}$ | Mean utility (BLP) | To estimate |
| $\mu_{ijm}$ | Individual deviation from the mean utility, generated by $\theta_2$ and random draws (a constructed quantity, not a free parameter) | Constructed quantity |
| $\lambda_k$ | Nest dissimilarity parameter (the smaller $\lambda_k$, the more similar within the nest), $\in(0,1]$ | To estimate |
| $\theta_1,\ \theta_2$ | Linear parameters $\theta_1=(\bar\beta,\bar\alpha)$ / nonlinear parameters $\theta_2=(\Pi,\Sigma)$ | To estimate |
| $\Sigma$ | Covariance (standard deviations) of the random coefficients, taste heterogeneity beyond demographics (BLP) | To estimate |
| $\Pi$ | How tastes vary with observed demographics (BLP) | To estimate |
| $\sigma_k$ | Standard deviation of the $k$-th random coefficient (the scale of heterogeneity) | To estimate |
| $D_i$ | Consumer demographics (income, age, and so on), the observed input to BLP simulation | Observed |
| $\nu_i$ | Standard-normal random taste draws, drawn independently for each consumer in simulation | Set by the researcher |
| $P_{nj}$ | Probability that individual $n$ chooses $j$ | Choice probability |
| $S_{jm}$$,\ \hat S_{jm}$ | Observed and predicted shares of option $j$ in market $m$ (BLP) | Share (aggregate) |
| $Z$ | Matrix of instruments | Observed |
| $W$ | GMM weighting matrix (set by the researcher in the first step, with the optimal weight estimated from residuals in the second) | Set by the researcher / estimated from data |
| $\gamma$ | Euler's constant $\approx 0.5772$, the location correction of the logsum (derived from Type I extreme value) | Constant |
| $R$ | Number of simulation draws | Set by the researcher |
| $CS$ | Consumer surplus | Welfare |
9.6 Troubleshooting Guide
Below are the four most common symptoms, each laid out in three parts: possible causes, checks, and fixes. This material comes from estimation practice and pairs with the diagnostic discipline of Step 5 in section 9.1.
Symptom 1: the optimizer does not converge
- Possible causes: poor starting values; wildly different variable scales; a flat or multimodal likelihood surface; the BLP inner loop not converging.
- Checks: whether the log-likelihood improves monotonically (a decrease points to a wrong step size or gradient); whether the variables' scales are comparable; whether the gradient norm heads toward zero.
- Fixes: use coefficients from a simple logit or a coarse grid search as starting values; standardize all variables to mean 0 and standard deviation 1; switch optimizers (BFGS/L-BFGS/Powell); for BLP, use SQUAREM to accelerate the inner loop, initialize $\delta$ from the Berry inversion, and tighten the inner-loop contraction tolerance to the order of $10^{-14}$: a loose setting like $10^{-6}$ leaves the inner residuals unsolved, and they seep along $\delta$ into the outer GMM objective, pulling the outer optimization off course and even producing spurious local optima; to be safe, recompute once each at $10^{-12}$ and $10^{-16}$ and confirm the estimates do not drift with the tolerance (Dubé, Fox & Su 2012).
Symptom 2: standard errors blow up
- Possible causes: multicollinearity that makes the information matrix nearly singular; too small a sample or insufficient identification; weak instruments; overparameterization.
- Checks: compute the variable correlation matrix and the condition number of the Jacobian/information matrix appropriate to the estimator; report a weak-instrument diagnostic matched to the endogenous variables and error structure, not just an unqualified first-stage F; check whether any parameter sits at a boundary.
- Fixes: drop genuinely redundant variables or reparameterize collinear attributes; guided by the economic mechanism, look for more relevant instruments with credible exclusion restrictions, and control the too-many-instruments problem with dimension reduction or optimal-instrument methods rather than curing weak identification by blindly adding IVs; trim random coefficients that lack identification. Changing the market definition alters both the economic object and the outside share at once, so adopt it only with a substantive reason and a robustness comparison.
Symptom 3: elasticity signs or magnitudes look wrong
- Possible causes: a positive price coefficient (endogeneity untreated or a scale error); inconsistent price units (yuan mixed with thousands of yuan); miscoded shares.
- Checks: the price coefficient's sign must be negative; verify the price units; confirm that shares lie between 0 and 1 and are of a reasonable magnitude; hand-compute one case with the formula $\eta_{jj}=\beta_{\text{price}}p_j(1-P_j)$ as a cross-check.
- Fixes: treat price endogeneity with credible exogenous price variation or IV/BLP, and re-estimate after unifying the price units. A reasonable elasticity magnitude depends on the market definition, the time unit, product durability, the outside option, and the object of study; there is no universal acceptable band of −1 to −5, and it should be checked jointly against evidence from comparable markets, the implications of profit maximization, and supply-side markups. In the illustration, $\eta_{AA}=-2.33$ and $\eta_{CC}=-4.28$ serve only to recheck this book's worked examples. illustrative data
Symptom 4: predicted shares differ widely from actual
- Possible causes: an omitted key attribute or interaction term; a market definition that is too coarse or too fine; IIA constraining the substitution pattern; price endogeneity.
- Checks: align predicted and observed shares by subgroup (the grouped fit of section 9.2) to locate which dimension the bias falls in; compare against the diagnostic tree of 9.2.
- Fixes: add the omitted attribute or change the functional form; upgrade to nested/mixed when the substitution pattern is counterintuitive; adjust the market granularity; ensure the outside-option share is greater than 0 to avoid $\ln 0$.
9.7 Common Pitfalls
This section collects pitfalls at the workflow level; the technical pitfalls internal to each chapter appear in that chapter's three-part set. This table plays a distinct role from the two components before it: 9.1 flags the trap at each step in place and its closing index table serves as an item-by-item pre-submission self-check, while this table starts from consequences, spelling out what each kind of pitfall costs once you commit it.
| Pitfall | Why it's wrong | What to do instead |
|---|---|---|
| Estimate the model first, think about the research question later | The model exists to serve the counterfactual; reversing the order yields an elegant estimate whose answer no one needs | Write the counterfactual first, judge whether structure is worth it, then pick the model (Step 1 of 9.1) |
| Report robustness without using it as a diagnostic | Listing columns side by side without interpretation is as good as no robustness at all; the conclusion may hang on an unexamined assumption and flip under a different specification | Read out of the robustness matrix “which conclusion rests on which assumption” (Step 5 of 9.1) |
| Treat in-sample fit as validation | Enough degrees of freedom will hug the data; and an aggregate fit hides systematic bias in the subgroups | Do all three layers: grouped fit, out-of-sample holdout, and parameter recovery (section 9.2) |
| A counterfactual that does not re-solve equilibrium | Prices or products change with the policy; a counterfactual that fixes them can be more misleading than the reduced form | Any counterfactual that changes firms' optimal behavior must re-equilibrate the supply side (Step 7 of 9.1) |
| Cite numbers from real papers without checking the source | Numbers are easily distorted in paraphrase, and one wrong number can shake the credibility of a whole argument | For numbers you are unsure of, write only a qualitative conclusion; to state a specific number, go back to the source and check |
| Run code without setting a random seed | Simulation-based estimates (MSL, bootstrap, Monte Carlo) become irreproducible, and others cannot recheck them | Fix the seed at every random step; parameter recovery and counterfactuals should both recompute with one click (section 9.2) |
9.8 Chapter Summary
This chapter reduces the book from a box of tools into a single workflow. From choices to counterfactuals, the full chain runs like this: first write down the counterfactual that exceeds the variation in the data and weigh whether it is worth reaching for a structural model (Chapter 02); translate it into an agent, a choice set, and a utility specification, and derive choice probabilities along RUM plus a distributional assumption (Chapter 03); relax IIA as the substitution pattern requires (Chapter 04); handle the integrals with no closed form by simulation (Chapter 05); correct price endogeneity with instruments and BLP (Chapter 06); extend to a dynamic model when forward-looking motives arise (Chapter 07); and put these tools back into the platform setting (Chapter 08); then write the identification map, run convergence and robustness diagnostics, complete all three layers of validation, and finally re-solve the equilibrium, compute welfare with intervals attached, and report it faithfully. The order of these seven steps is itself the operationalization of this chain.
Finally, we should honestly mark the boundary. What a structural model can do for you is this: in an environment never observed, make grounded, checkable predictions, pull mechanisms apart, work out welfare, and lay out plainly the assumptions the extrapolation rests on, for others to argue with. What it cannot do for you is guarantee that the distributional assumption is true, make endogeneity vanish into thin air, or hold up when extrapolated to another population or another era. Two sentences are worth committing to memory: passing parameter recovery only says the code estimates correctly under the given DGP, not that the model specification is true; a good fit only shows that the degrees of freedom are sufficient, not that the conclusion is credible. The value of structural estimation has never rested on the label of the method, but on whether you can spell out the identification of every primitive and leave others a handle by which to falsify it. Do this solidly and the road from choices to counterfactuals truly goes through.
Further Reading
Structural modeling practice and methodology
- Reiss, P. C., & Wolak, F. A. (2007). Structural econometric modeling: Rationales and examples from industrial organization. In J. J. Heckman & E. E. Leamer (Eds.), Handbook of econometrics (Vol. 6A, pp. 4277–4415). Elsevier. https://doi.org/10.1016/S1573-4412(07)06064-3 (the practical rationale and examples for structural modeling in industrial organization)
- Galiani, S., & Pantano, J. (2021). Structural models: Inception and frontier (Working Paper No. 28698). National Bureau of Economic Research. https://doi.org/10.3386/w28698
- Keane, M. P. (2010). Structural vs. atheoretic approaches to econometrics. Journal of Econometrics, 156(1), 3–20. https://doi.org/10.1016/j.jeconom.2009.09.003
- Low, H., & Meghir, C. (2017). The use of structural models in econometrics. Journal of Economic Perspectives, 31(2), 33–58. https://doi.org/10.1257/jep.31.2.33
Demand estimation and BLP practice
- Berry, S., Levinsohn, J., & Pakes, A. (1995). Automobile prices in market equilibrium. Econometrica, 63(4), 841–890. https://doi.org/10.2307/2171802
- Nevo, A. (2001). Measuring market power in the ready-to-eat cereal industry. Econometrica, 69(2), 307–342. https://doi.org/10.1111/1468-0262.00194
- Dubé, J.-P., Fox, J. T., & Su, C.-L. (2012). Improving the numerical performance of static and dynamic aggregate discrete choice random coefficients demand estimation. Econometrica, 80(5), 2231–2267. https://doi.org/10.3982/ECTA8585 (how the inner-loop contraction tolerance affects the outer GMM, and the numerical robustness of tight tolerances and MPEC)
- Conlon, C., & Gortmaker, J. (2020). Best practices for differentiated products demand estimation with PyBLP. The RAND Journal of Economics, 51(4), 1108–1161. https://doi.org/10.1111/1756-2171.12352 (the PyBLP implementation and robustness recommendations)
Welfare, dynamics, and validation
- Small, K. A., & Rosen, H. S. (1981). Applied welfare economics with discrete choice models. Econometrica, 49(1), 105–130. https://doi.org/10.2307/1911129 (the theoretical basis for logsum consumer surplus)
- Rust, J. (1987). Optimal replacement of GMC bus engines: An empirical model of Harold Zurcher. Econometrica, 55(5), 999–1033. https://doi.org/10.2307/1911259
- Hotz, V. J., & Miller, R. A. (1993). Conditional choice probabilities and the estimation of dynamic models. The Review of Economic Studies, 60(3), 497–529. https://doi.org/10.2307/2298122
Textbooks
- Train, K. E. (2009). Discrete choice methods with simulation (2nd ed.). Cambridge University Press. (systematic coverage of the simulation estimation of logit, GEV, and mixed logit)