<p>Let me focus on the use of duality theory in demand analysis (as this is what I'm most familiar with).</p>
<h2>Direct approach</h2>
<p>Usually, in order to obtain a demand system (which you can then estimate) you need to take the following steps.</p>
<ol>
<li>specify a utility function <span class="math-container">$u(x_1, \ldots, x_n)$</span>.</li>
<li>maximize this with respect to a budget constraint <span class="math-container">$\sum_i p_i x_i \le m$</span>. .</li>
<li>Obtain a closed form solution for <span class="math-container">$x_i$</span> as a function of all prices <span class="math-container">$(p_1,\ldots, p_n)$</span> and income <span class="math-container">$m$</span>.</li>
<li>Estimate these functions.</li>
</ol>
<p>Step 3 is the trickiest part as usually no closed form solutions are possible. To see this, notice that the first order conditions give the following system:
<span class="math-container">$$
\frac{\partial u(x_1, \ldots, x_n)}{\partial x_n} = p_i\,\, \lambda,\\
\sum_i p_i x_i = m.
$$</span>
Solving for <span class="math-container">$\lambda$</span> we have:
<span class="math-container">$$
\dfrac{\dfrac{\partial u}{\partial x_i}}{\sum_j \dfrac{\partial u}{\partial p_j}} = \frac{p_i}{m}
$$</span>
This gives the (normalized) prices on the right hand side as a function of the quantities (so the inverse demand functions). To obtain a closed form solution of the quantities in terms of the functions, this system needs to be inverted. Except in some particular cases (e.g. Cobb-Douglas or CES) we do not know how to do this.</p>
<h2>Dual approach</h2>
<p>The dual approach starts from a specification of the expenditure function and uses known duality results to obtain a closed form expression for the demand functions. It takes the following steps:</p>
<ol>
<li>Specify an expenditure function <span class="math-container">$e(p_1, \ldots, p_n,u)$</span>.</li>
<li>Use Shephard's lemma to obtain the Hicksian demand function <span class="math-container">$h_i(p_1,\ldots, p_n, u)$</span>.</li>
<li>Invert <span class="math-container">$e(p_1, \ldots, p_n, u)$</span> with respect to <span class="math-container">$u$</span> to get the indirect utility function <span class="math-container">$v(p_1, \ldots, p_n, u)$</span>.</li>
<li>substitute <span class="math-container">$v(p_1, \ldots, p_n, u)$</span> in <span class="math-container">$h(p_1, \ldots, p_n, u)$</span> to get the Marshallian demands <span class="math-container">$x_i(p_1, \ldots, p_n, m)$</span>.</li>
</ol>
<p>As an exemple, consider the widely used Almost Ideal Demand System specification of <a href="https://www.aeaweb.org/aer/top20/70.3.312-326.pdf" rel="nofollow noreferrer">Deaton &amp; Muellbauer</a></p>
<p>Start from the following (flexible) specification for the expenditure function.
<span class="math-container">$$
\ln e(p,u) = \alpha_0 + \sum_i \alpha_i \ln(p_i) + \sum_{i,j}\frac{1}{2}\gamma_{i,j} \ln(p_i) \ln(p_j) + u \prod_i p_i^{\beta_i}
$$</span>
We impose <span class="math-container">$\gamma_{i,j} = \gamma_{j,i}$</span>, and by homogeneity of degree 1 we have that <span class="math-container">$\sum_i \alpha_i = 1$</span> and <span class="math-container">$\sum_{i = 1}^n \gamma_{i,j} = 1$</span> and <span class="math-container">$\sum_{i} \beta_i = 0$</span>.</p>
<p>First we can take the derivative <span class="math-container">$\frac{\partial \ln e(p,u)}{\partial \ln p_i}$</span> to get the demand share equations. Shephard's lemma gives:
<span class="math-container">$$
\frac{\partial \ln e(p,u)}{\partial \ln p_i} = \frac{p_i h_i(p,u)}{e(p,u)} = \alpha_i + \sum_j \frac{1}{2}\gamma_{i,j} \ln(p_j) + u \beta_0 \beta_i \prod_i p_i^{\beta_i}
$$</span>
Here <span class="math-container">$h_i(p,u)$</span> is the Hicksian demand for good <span class="math-container">$i$</span>.</p>
<p>Writing by <span class="math-container">$v(p,m)$</span> the indirect utility function, we know by duality between utility maximisation and expenditure minimisation that:
<span class="math-container">$$
m = e(p,v(p,m)) \text{ or } u = v(p,e(p,u)).
$$</span>
Using this, we can invert the expenditure function to obtain the indirect utility function.
<span class="math-container">$$
v(p,m) = \frac{\ln m - \alpha_0 - \sum_j \alpha_j \ln(p_j) - \sum_{i,j}\frac{1}{2} \gamma_{i,j} \ln(p_i) \ln(p_j)}{\beta_0 \prod_i p_i^{\beta_i}}
$$</span></p>
<p>Also by duality, if <span class="math-container">$x(p,m)$</span> is the Marshallian demand function then:
<span class="math-container">$$
x_i(p,m) = h_i(p,v(p,m)).
$$</span>
So we can substitute <span class="math-container">$v(p,m)$</span> into <span class="math-container">$h_i(p,u)$</span> to get the shares as a function of prices and income.</p>
<p><span class="math-container">$$
\begin{align*}
s_i(p,m) &amp;= \frac{p_i x(p,m)}{m} = \alpha_i + \sum_j \frac{1}{2}\gamma_{i,j} \ln(p_j) + \beta_i \left(\ln m - \alpha_0 - \sum_j \alpha_j \ln(p_j) - \frac{1}{2}\sum_{i,j} \gamma_{i,j} \ln(p_i) \ln(p_j)\right),\\
&amp;= \alpha_i + \sum_j \frac{1}{2}\gamma_{i,j} \ln(p_j) + \beta_i \ln(m/P).
\end{align*}
$$</span>
where:
<span class="math-container">$$
P = \alpha_0 + \sum_j \alpha_j \ln(p_j) + \sum_{i,j} \frac{1}{2}\gamma_{i,j} \ln(p_i)\ln(p_j).
$$</span>
This is the Almost Ideal Demand System. Conditional on <span class="math-container">$P$</span>, shares are linear in the log of income and log of prices. The symmetry and homogeneity restrictions immediately translate to conditions on the coefficients of this system.</p>

CC BY-SA 4.0
2021-05-18T10:23:45.350Z
2021-05-18T10:23:45.350Z
tdm
<p><a href="https://onlinelibrary.wiley.com/doi/pdf/10.1111/1467-8292.00077?casa_token=5J1EMBUYB6MAAAAA:SGShbCkvrYmRk4Zd6ojuH_Yh_32ApyLSzT1ED2f9irwaZWpcTuQSgSBvc85Cyw57S3mHONOPceOmgA" rel="nofollow noreferrer">Here's a paper link where they picked up a <span class="math-container">$R^2$</span> of over .99</a>  I don't think this is particularly unusual or strange of a result, either. In estimating costs for firms in public utilities, I recall doing numerous exercises with real data from various utilities.  I typically got <span class="math-container">$R^2$</span>'s in the 0.95's or higher, so I feel they are fairly accurate within sample.</p>
<p>This means economists are fairly good at estimating what a firm's per-unit costs are if we have a good knowledge of their total capital stock and expenditures, and we stay within the bounds of our sample.</p>
<p>However, if you are asking about very far out-of-sample predictions, or systemic shifts in the market, then you may find less success.</p>

CC BY-SA 4.0
2020-10-11T23:25:58.917Z
2020-10-11T23:25:58.917Z
RegressForward
<p>In economic theory we know that with the use of some calculus, <a href="https://en.wikipedia.org/wiki/Hotelling%27s_lemma" rel="noreferrer">Hotellings Lemma</a> and <a href="https://en.wikipedia.org/wiki/Shephard%27s_lemma" rel="noreferrer">Sheppards lemma</a> we can derive a given firms supply function and in term its Profit function.</p>

<p>With data of a given firms costs, can we in fact get an accurate estimate of its profit function and supply function? </p>

CC BY-SA 3.0
2017-04-02T23:44:44.480Z
Great question. I hope someone pulls data and answers this.
123
CC BY-SA 3.0
2017-04-04T09:28:21.230Z
Maybe [this](http://ageconsearch.umn.edu/bitstream/31089/1/27010094.pdf) and [this](https://core.ac.uk/download/pdf/6563857.pdf) could help. The latter says that the estimation of cost function from profit function is better than the reverse.
luchonacho
CC BY-SA 4.0
2018-09-28T01:10:26.737Z
As you stated in the question, theoretically if cost is known, then supply and profit are known. So the estimate is perfectly accurate. To clarify the question, are you asking how empirically accurate is cost estimation usually? Or if costs are mis-estimated, then what is the error with which the supply and profit are estimated?
Sander Heinsalu
<microeconomics><mathematical-economics><applied-econometrics><duality>
How accurate is duality?
EconJohn
# How accurate is duality?

(Asked by: username_0 on 2017-04-02)

In economic theory we know that with the use of some calculus, [Hotellings Lemma](https://en.wikipedia.org/wiki/Hotelling%27s_lemma) and [Sheppards lemma](https://en.wikipedia.org/wiki/Shephard%27s_lemma) we can derive a given firms supply function and in term its Profit function.

With data of a given firms costs, can we in fact get an accurate estimate of its profit function and supply function?

**Tags:** microeconomics, mathematical-economics, applied-econometrics, duality

> **Comments:**
> **username_1**: Great question. I hope someone pulls data and answers this.  
> **username_2**: Maybe [this](http://ageconsearch.umn.edu/bitstream/31089/1/27010094.pdf) and [this](https://core.ac.uk/download/pdf/6563857.pdf) could help. The latter says that the estimation of cost function from profit function is better than the reverse.  
> **username_3**: As you stated in the question, theoretically if cost is known, then supply and profit are known. So the estimate is perfectly accurate. To clarify the question, are you asking how empirically accurate is cost estimation usually? Or if costs are mis-estimated, then what is the error with which the supply and profit are estimated?  

---

## 2 answers

### Answer by username_4 on 2021-05-18. Score: 4

Let me focus on the use of duality theory in demand analysis (as this is what I'm most familiar with).

## Direct approach

Usually, in order to obtain a demand system (which you can then estimate) you need to take the following steps.

1. specify a utility function $u(x\_1, \ldots, x\_n)$.
2. maximize this with respect to a budget constraint $\sum\_i p\_i x\_i \le m$. .
3. Obtain a closed form solution for $x\_i$ as a function of all prices $(p\_1,\ldots, p\_n)$ and income $m$.
4. Estimate these functions.

Step 3 is the trickiest part as usually no closed form solutions are possible. To see this, notice that the first order conditions give the following system:
$$
\frac{\partial u(x\_1, \ldots, x\_n)}{\partial x\_n} = p\_i\,\, \lambda,\\
\sum\_i p\_i x\_i = m.
$$
Solving for $\lambda$ we have:
$$
\dfrac{\dfrac{\partial u}{\partial x\_i}}{\sum\_j \dfrac{\partial u}{\partial p\_j}} = \frac{p\_i}{m}
$$
This gives the (normalized) prices on the right hand side as a function of the quantities (so the inverse demand functions). To obtain a closed form solution of the quantities in terms of the functions, this system needs to be inverted. Except in some particular cases (e.g. Cobb-Douglas or CES) we do not know how to do this.

## Dual approach

The dual approach starts from a specification of the expenditure function and uses known duality results to obtain a closed form expression for the demand functions. It takes the following steps:

1. Specify an expenditure function $e(p\_1, \ldots, p\_n,u)$.
2. Use Shephard's lemma to obtain the Hicksian demand function $h\_i(p\_1,\ldots, p\_n, u)$.
3. Invert $e(p\_1, \ldots, p\_n, u)$ with respect to $u$ to get the indirect utility function $v(p\_1, \ldots, p\_n, u)$.
4. substitute $v(p\_1, \ldots, p\_n, u)$ in $h(p\_1, \ldots, p\_n, u)$ to get the Marshallian demands $x\_i(p\_1, \ldots, p\_n, m)$.

As an exemple, consider the widely used Almost Ideal Demand System specification of [Deaton & Muellbauer](https://www.aeaweb.org/aer/top20/70.3.312-326.pdf)

Start from the following (flexible) specification for the expenditure function.
$$
\ln e(p,u) = \alpha\_0 + \sum\_i \alpha\_i \ln(p\_i) + \sum\_{i,j}\frac{1}{2}\gamma\_{i,j} \ln(p\_i) \ln(p\_j) + u \prod\_i p\_i^{\beta\_i}
$$
We impose $\gamma\_{i,j} = \gamma\_{j,i}$, and by homogeneity of degree 1 we have that $\sum\_i \alpha\_i = 1$ and $\sum\_{i = 1}^n \gamma\_{i,j} = 1$ and $\sum\_{i} \beta\_i = 0$.

First we can take the derivative $\frac{\partial \ln e(p,u)}{\partial \ln p\_i}$ to get the demand share equations. Shephard's lemma gives:
$$
\frac{\partial \ln e(p,u)}{\partial \ln p\_i} = \frac{p\_i h\_i(p,u)}{e(p,u)} = \alpha\_i + \sum\_j \frac{1}{2}\gamma\_{i,j} \ln(p\_j) + u \beta\_0 \beta\_i \prod\_i p\_i^{\beta\_i}
$$
Here $h\_i(p,u)$ is the Hicksian demand for good $i$.

Writing by $v(p,m)$ the indirect utility function, we know by duality between utility maximisation and expenditure minimisation that:
$$
m = e(p,v(p,m)) \text{ or } u = v(p,e(p,u)).
$$
Using this, we can invert the expenditure function to obtain the indirect utility function.
$$
v(p,m) = \frac{\ln m - \alpha\_0 - \sum\_j \alpha\_j \ln(p\_j) - \sum\_{i,j}\frac{1}{2} \gamma\_{i,j} \ln(p\_i) \ln(p\_j)}{\beta\_0 \prod\_i p\_i^{\beta\_i}}
$$

Also by duality, if $x(p,m)$ is the Marshallian demand function then:
$$
x\_i(p,m) = h\_i(p,v(p,m)).
$$
So we can substitute $v(p,m)$ into $h\_i(p,u)$ to get the shares as a function of prices and income.

$$
\begin{align\*}
s\_i(p,m) &= \frac{p\_i x(p,m)}{m} = \alpha\_i + \sum\_j \frac{1}{2}\gamma\_{i,j} \ln(p\_j) + \beta\_i \left(\ln m - \alpha\_0 - \sum\_j \alpha\_j \ln(p\_j) - \frac{1}{2}\sum\_{i,j} \gamma\_{i,j} \ln(p\_i) \ln(p\_j)\right),\\
&= \alpha\_i + \sum\_j \frac{1}{2}\gamma\_{i,j} \ln(p\_j) + \beta\_i \ln(m/P).
\end{align\*}
$$
where:
$$
P = \alpha\_0 + \sum\_j \alpha\_j \ln(p\_j) + \sum\_{i,j} \frac{1}{2}\gamma\_{i,j} \ln(p\_i)\ln(p\_j).
$$
This is the Almost Ideal Demand System. Conditional on $P$, shares are linear in the log of income and log of prices. The symmetry and homogeneity restrictions immediately translate to conditions on the coefficients of this system.


---

### Answer by username_5 on 2020-10-11. Score: 0

[Here's a paper link where they picked up a $R^2$ of over .99](https://onlinelibrary.wiley.com/doi/pdf/10.1111/1467-8292.00077?casa_token=5J1EMBUYB6MAAAAA:SGShbCkvrYmRk4Zd6ojuH_Yh_32ApyLSzT1ED2f9irwaZWpcTuQSgSBvc85Cyw57S3mHONOPceOmgA) I don't think this is particularly unusual or strange of a result, either. In estimating costs for firms in public utilities, I recall doing numerous exercises with real data from various utilities. I typically got $R^2$'s in the 0.95's or higher, so I feel they are fairly accurate within sample.

This means economists are fairly good at estimating what a firm's per-unit costs are if we have a good knowledge of their total capital stock and expenditures, and we stay within the bounds of our sample.

However, if you are asking about very far out-of-sample predictions, or systemic shifts in the market, then you may find less success.


---

