Tutorials › Econometrics (Graduate) › Nonlinear GMM for Random-Coefficient Demand

Demand and Discrete Choice · Tutorial 734 of 952

Nonlinear GMM for Random-Coefficient Demand

Learn how inverted market shares, instrument orthogonality, and numerical optimization combine to estimate random-coefficient demand parameters.

Advanced 12 min read

What You'll Learn

  • Express inverted mean utilities as a linear index plus a demand residual.
  • State the instrument-residual cross-moment condition without confusing it with covariance.
  • Construct sample moments and the nonlinear GMM objective from product-level instruments.
  • Profile out linear demand coefficients at each candidate nonlinear parameter value.
  • Interpret the recovered price coefficient and check identification conditions.

From Market Shares to GMM Moments

Random-coefficient demand estimation has two linked tasks. For each candidate value of the parameters governing consumer heterogeneity, the market-share inversion supplies mean utilities consistent with observed shares. Those mean utilities must then be reconciled with observed product characteristics and prices, while allowing for unobserved product appeal. Product-level instruments connect that unobserved appeal to identifying variation in the observed data.

The purpose here is to build that connection into a nonlinear generalized method of moments (GMM) objective. The inversion is an input: at a trial heterogeneity parameter, it maps observed market shares to mean utilities. The GMM step chooses parameters so that the resulting demand residuals satisfy the instrument moment conditions.

Definition: Let \(t\) index markets and \(j\) index products in a market. Write \(\delta_{jt}(s_t;\theta_2)\) for the mean utility that the market-share inversion yields for product \(j\) in market \(t\), given observed shares \(s_t\) and nonlinear parameters \(\theta_2\). Let \(d_{jt}\) be a vector of observed demand regressors, including price, and let \(\gamma\) be their linear coefficients. The mean-utility equation and its unobserved demand residual are $$ \delta_{jt}(s_t;\theta_2)=d_{jt}'\gamma+\xi_{jt}, \qquad \xi_{jt}=\delta_{jt}(s_t;\theta_2)-d_{jt}'\gamma. $$

In a common parameterization, \(\theta_2\) governs the dispersion of random coefficients across consumers, while \(\gamma\) contains their mean effects. For example, if \(d_{jt}\) includes price \(p_{jt}\), its coefficient in \(\gamma\) is often written \(-\alpha\), with \(\alpha>0\) representing a negative mean price effect. The particular partition between linear and nonlinear parameters depends on the model’s normalization and parameterization. The key requirement is that, conditional on \(\theta_2\), the mean-utility equation is linear in \(\gamma\).

The unobserved component \(\xi_{jt}\) represents product appeal not captured by the included regressors. Price may respond to that appeal: for example, a firm may charge more for a product whose unobserved quality is high. Ordinary least squares can then confound the price effect with unobserved appeal. Instruments are used to supply variation in the regressors that is orthogonal to the demand residual under the maintained assumptions.

Instrument Orthogonality and the Sample Objective

Let \(z_{jt}\) be a vector of product-level instruments. The maintained population restriction is a zero cross-moment between the instruments and the demand residual:

$$ E[z_{jt}\xi_{jt}]=0. $$

This is an instrument-residual orthogonality (zero cross-moment) condition. It is not, in general, the same as saying that the covariance is zero. Covariance centers both variables; the displayed restriction does not. For scalar variables, \(\operatorname{Cov}(z,\xi)=E[z\xi]-E[z]E[\xi]\). Thus zero covariance implies the displayed condition only with an additional restriction such as \(E[z]E[\xi]=0\); conversely, a zero cross-moment does not generally imply zero covariance. GMM uses the stated cross-moment restriction, with the model’s assumptions specifying when it is justified.

In the sample, stack the product-level instruments into a matrix \(Z\), and stack the regressors and inverted mean utilities into \(X\) and \(\delta(\theta_2)\), respectively. Let \(N\) be the number of product-market observations being averaged. For a given pair \((\gamma,\theta_2)\), define the sample moment vector and GMM criterion as follows:

$$ g_N(\gamma,\theta_2) = \frac{1}{N}Z'\left[\delta(\theta_2)-X\gamma\right], \qquad Q_N(\gamma,\theta_2) = g_N(\gamma,\theta_2)'Wg_N(\gamma,\theta_2). $$

Here \(W\) is a symmetric positive-definite weighting matrix, chosen or estimated by the researcher. Each entry of \(g_N\) is an average instrument-residual cross-product. The objective is small when the sample cross-moments are close to zero, relative to the chosen weighting. With more moments than coefficients, a finite sample will generally not permit every sample moment to equal zero, so the criterion balances them.

The equal-observation average above weights each product-market observation equally. If the intended sampling or target population calls for a different weighting of markets, the moments must be constructed to reflect that choice. Inference also depends on the sampling structure: products within a market may share demand shocks, so treating every product as an independent market observation can give inappropriate uncertainty estimates.

Worked Example: Calculating a Product-Level Sample Moment

Suppose a hypothetical inversion and coefficient choice produce three product-level demand residuals, in utility units, of \(0.20\), \(-0.10\), and \(0.30\). For one instrument, suppose the corresponding values are \(1\), \(2\), and \(1\). Calculate the sample cross-moment using an equal-observation average.

The scalar sample moment is the average of the instrument times the residual:

$$ g_N=\frac{1}{3}\sum_{i=1}^{3}z_i\xi_i =\frac{1}{3}\left[(1)(0.20)+(2)(-0.10)+(1)(0.30)\right] =\frac{0.20-0.20+0.30}{3} =0.10. $$

The moment is \(0.10\) in the instrument-times-utility units. It is not zero in this sample, even if the population cross-moment is assumed to be zero. With one moment and \(W=1\), its contribution to the criterion is \(Q_N=(0.10)^2=0.0100\). A small moment is not by itself evidence that the instrument is valid: validity is a maintained economic and statistical assumption, not a property established by this calculation.

Profiling Out the Linear Coefficients

For any fixed \(\theta_2\), the inverted utilities \(\delta(\theta_2)\) are known numerically, and the criterion is quadratic in \(\gamma\). This structure lets the researcher solve for the linear coefficients at each trial nonlinear parameter value rather than searching over all parameters simultaneously. In the exactly identified case, the sample moments can sometimes be set to zero. In the overidentified case, the weighted least-squares solution minimizes the criterion.

Result: For fixed \(\theta_2\), let \(A=Z'X/N\) and \(b=Z'\delta(\theta_2)/N\), so \(g_N=b-A\gamma\). If \(W\) is symmetric positive definite and \(A'WA\) is nonsingular, the coefficient vector minimizing the criterion at this \(\theta_2\) is $$ \widehat{\gamma}(\theta_2) = (A'WA)^{-1}A'Wb. $$ The concentrated criterion is \(Q_N(\widehat{\gamma}(\theta_2),\theta_2)\), which is then minimized over the admissible values of \(\theta_2\).

The formula follows directly by differentiating the quadratic criterion. Holding \(\theta_2\) fixed, write \(Q_N=(b-A\gamma)'W(b-A\gamma)\). Since \(W\) is symmetric, its derivative with respect to \(\gamma\) is \(-2A'W(b-A\gamma)\). Setting this derivative to zero gives the normal equations \(A'WA\gamma=A'Wb\); nonsingularity yields the stated solution. This is a conditional calculation: changing \(\theta_2\) changes the inverted utilities \(b\), so the profiled coefficients generally change too.

Worked Example: Recovering Demand Coefficients at Fixed Nonlinear Parameters

Consider a hypothetical three-observation illustration at one fixed value of \(\theta_2\). Suppose the inversion gives \(\delta=(3.6,-1.8,1.8)'\), the regressor matrix has an intercept and price \(p=(1,2,3)'\), and the instrument matrix has a constant and an excluded product characteristic \(w=(0,1,3)'\):

$$ X= \begin{pmatrix} 1&1\\ 1&2\\ 1&3 \end{pmatrix}, \qquad Z= \begin{pmatrix} 1&0\\ 1&1\\ 1&3 \end{pmatrix}. $$

For this exactly identified illustration, use the sample equations \(Z'(\delta-X\gamma)=0\), where \(\gamma=(\gamma_0,\gamma_p)'\). The first equation sums the residuals; the second weights them by \(w\):

$$ \begin{aligned} 3\gamma_0+6\gamma_p&=3.6,\\ 4\gamma_0+11\gamma_p&=3.6. \end{aligned} $$

Subtract four-thirds of the first equation from the second, or substitute \(\gamma_0=1.2-2\gamma_p\) from the first into the second:

$$ 4(1.2-2\gamma_p)+11\gamma_p=3.6 \quad\Longrightarrow\quad 3\gamma_p=-1.2 \quad\Longrightarrow\quad \gamma_p=-0.4, \qquad \gamma_0=2.0. $$

Thus the fitted mean-utility index is \(2.0-0.4p\), and the residuals are \((2,-3,1)'\). Their sum is \(2-3+1=0\), and their instrument-weighted sum is \(0(2)+1(-3)+3(1)=0\), verifying both moment equations. Under the convention \(\gamma_p=-\alpha\), the recovered mean price sensitivity is \(\widehat{\alpha}=0.4\) utility units per price unit. These three observations are deliberately illustrative; they do not establish precision or identification in an actual application.

Nonlinear Optimization and Coefficient Recovery

The nonlinear search uses the concentrated criterion. At each admissible trial value of \(\theta_2\), the researcher recomputes the mean utilities from the observed market shares, obtains \(\widehat{\gamma}(\theta_2)\), and evaluates the weighted moment criterion. The minimizing \(\widehat{\theta}_2\), together with \(\widehat{\gamma}(\widehat{\theta}_2)\), gives the parameter estimates. If coefficients are constrained—for example, to ensure a negative mean price coefficient—the optimization or coefficient-recovery step must enforce the relevant constraint.

This optimization is typically numerical because the inversion and the resulting criterion need not have a closed-form solution as functions of \(\theta_2\). A numerical optimizer returns a minimizer among the parameter values it searches; it does not prove that the global minimum has been found. Parameter constraints, sensible starting values, and checks of the resulting moments and fitted shares are part of responsible implementation.

Worked Example: Comparing Nonlinear Parameter Candidates

Suppose, for illustration, profiling the linear coefficients at two hypothetical nonlinear parameter values produces two moment vectors, and use the identity matrix for \(W\). At candidate A, let \(g_N=(0.10,-0.05)'\); at candidate B, let \(g_N=(0.02,0.03)'\). Compare their criteria.

For candidate A, the objective is the sum of the squared moments:

$$ Q_A = \begin{pmatrix}0.10&-0.05\end{pmatrix} \begin{pmatrix}0.10\\-0.05\end{pmatrix} = (0.10)^2+(-0.05)^2 = 0.0100+0.0025 = 0.0125. $$

For candidate B, the corresponding calculation is

$$ Q_B=(0.02)^2+(0.03)^2=0.0004+0.0009=0.0013. $$

Candidate B has the lower criterion among these two candidates. This comparison alone does not show that B is the overall minimizing parameter value: other admissible values may have a still smaller criterion. Nor does a low criterion alone establish that the model’s assumptions or instruments are valid.

After estimation, the linear coefficients are recovered at the selected nonlinear parameters. Under the common price convention \(\delta_{jt}=d_{jt}'\gamma+\xi_{jt}\) with price coefficient \(-\alpha\), \(\widehat{\alpha}=-\widehat{\gamma}_p\). It measures the mean utility change per unit change in price, holding the other included regressors fixed. Random-coefficient parameters describe heterogeneity as specified by the model; they do not replace the mean coefficients. The interpretation of either depends on the units of the corresponding regressors.

Assumptions and Identification

A small GMM objective is meaningful only in relation to the assumptions that make the moments informative. The demand model and its share inversion must represent the chosen market and outside option correctly. The product-level instruments must satisfy the maintained zero cross-moment restriction with the demand residual, and the regressors and instruments must contain enough independent variation to distinguish the parameters of interest.

For the linear coefficient step, the condition that \(A'WA\) is nonsingular ensures a unique profiled coefficient vector at a fixed \(\theta_2\). The nonlinear parameters also need to be identified by how the population moments change with them; merely having many instruments does not guarantee this. If different parameter values imply effectively the same moments, the data do not distinguish those values well. In applications, weak identification can make estimates sensitive to instrument choice, weighting, and sample variation.

A practical distinction is important: coefficient recovery is conditional on a chosen model, instruments, and weighting scheme. It does not turn a demand residual into an observed variable, and the moment equations do not by themselves demonstrate that excluded instruments are economically credible. Those claims require substantive justification in the application.

Common Mistake: Calling a Zero Cross-Moment a Zero Covariance

A frequent error is to write \(E[z_{jt}\xi_{jt}]=0\) and describe it as “zero covariance” without checking the means. For example, if \(z=1\) and \(\xi=1\) with probability one, then \(\operatorname{Cov}(z,\xi)=0\), because \(z\) has no variation, but \(E[z\xi]=1\), not zero. The reverse distinction matters too: a zero cross-moment need not imply zero covariance when both variables have nonzero means.

The correction is to name the condition precisely: GMM here imposes instrument-residual orthogonality, expressed as the zero cross-moment \(E[z_{jt}\xi_{jt}]=0\). If an argument instead uses zero covariance, it must state any additional mean restrictions needed to equate that covariance condition with the cross-moment being estimated.

Key takeaway: For each candidate heterogeneity parameter, invert the observed shares to obtain mean utilities, form residuals after subtracting the linear demand index, and evaluate their product-level instrument cross-moments. GMM chooses parameters to make those moments small under a justified weighting matrix and credible instrument assumptions.

Check Your Understanding

Answer these questions using the definitions and calculations above.

  1. In the mean-utility equation, which quantities change when the nonlinear parameter \(\theta_2\) changes, and which coefficients are linear conditional on it?
  2. Why is \(E[z_{jt}\xi_{jt}]=0\) not generally equivalent to \(\operatorname{Cov}(z_{jt},\xi_{jt})=0\)?
  3. With one instrument and residuals \(0.1\), \(0.2\), and \(-0.1\), paired with instrument values \(1\), \(2\), and \(1\), calculate the equal-observation sample cross-moment.
  4. What condition makes the profiled linear coefficient formula unique at a fixed \(\theta_2\)?
  5. If price has coefficient \(-\alpha\) in the mean-utility equation and the estimated price coefficient is \(-0.6\), what is the implied \(\widehat{\alpha}\), and what are its units?
Clinical Biostats