# Estimating CES utility (not production) function parameters

The CES utility function has the form $$$$u(x_1,\dots,x_n)=\left[\sum_{i=1}^n\alpha_ix_i^\rho\right]^{1/\rho},$$$$ where $$\alpha_i$$ is the consumption share parameter and $$\sigma=\frac{1}{1-\rho}$$ is the elasticity of substitution.

I'm interested in estimating the $$\alpha_i$$'s and $$\sigma$$. Since we do not directly observe utility levels, I think we can instead use data to estimate the Marshallian demand functions implied by the utility function: $$$$x_i(p_1,\dots,p_n,M)=\frac{M(\alpha_i/p_i)^\sigma}{\sum_{j=1}^n\alpha_j^\sigma p_j^{1-\sigma}},\quad i=1,\dots,n.$$$$ Clearly, the function is highly nonlinear in the parameters of interest. So a nonlinear estimation procedure would be required.

Say we have data consumption $$x_i$$, prices $$p_i$$ and income $$M$$. How do we go about estimating the parameters $$\alpha_i$$'s and $$\sigma$$?

I can find a lot of papers on estimating the CES production function, but I don't find them helpful since I don't observe the dependent variable ($$u$$). Given that the CES utility is a common functional form used in the literature, I suspect its estimation must be somewhere in the literature.

I managed to find the nonlinear least squares estimation in Stata, but I don't know how susceptible such a procedure is to misspecification and how much confidence one should put on the statistics (e.g. t-stat or p-value) produced by the program.

Any pointer to the papers/textbook chapters on the topic, as well as statistical packages that implement the estimation procedure will be greatly appreciated.

It may be interesting to exploit the homothetic separability of the CES utility function in $$x$$. It implies that $$\frac{x_i}{x_j} = \left( \frac{\alpha_i}{\alpha_j}\frac{p_j}{p_i} \right)^\sigma$$ and after $$log$$-transformation: $$\ln(x_i) - \ln(x_j) = \beta_{ij} + \sigma (\ln(p_j) - \ln(p_i)).$$

After adding a random term, this specification could be used to estimate the $$\beta_{ij} \equiv \sigma (\ln(\alpha_i)-\ln(\alpha_j))$$ and $$\sigma$$ parameters by OLS and in a second step identifying the $$\alpha_i$$ by minimum distance:

$$\widehat{\alpha} = \arg \min_\alpha \Big(\widehat{\beta}-\widehat{\sigma}(\ln(\alpha)-\ln(P\alpha)) \Big)'\Omega^{-1} \Big( \widehat{\beta}-\widehat{\sigma}(\ln(\alpha)-\ln(P\alpha)) \Big),$$ where $$P$$ represents the adequate permutation matrix.

Some references estimating parameters of CES preference parameters include Diewert and Feenstra (2017) or Redding and Weinstein (2020), with a different approach, however, based on the unit expenditure function.

Most empirical contributions reject the validity of homothetic utility functions (like the CES). There are some propositions on how to built nonhomothetic CES production functions that could easily extended to utility functions, see Shimomura (1999) and the references therein. A simple extension of the above specification is:

$$\ln(x_i) - \ln(x_j) = \beta_{ij} + \sigma (\ln(p_j) - \ln(p_i)) + \gamma_{ij} M/p + \varepsilon,$$ where $$p$$ denotes a consumer and time specific aggregate price index (over all commodities). Notation $$ij$$ stands for commodities $$i$$ and $$j$$ and not for the observations (I skipped the $$n,t$$ subscripts for clarity).

This relationship is compatible with nonhomothetic preferences. The homothetic case is obtained for $$\gamma_{ij}=0$$ which can be tested.

Regarding the computer software... I fully switched to R few years ago, it would "easily" allow to code the minimum distance estimator, and the link between the utility and demand functions.

References:

Diewert, Erwin and Robert Feenstra (2017), “Estimating the Benefits and Costs of New and Disappearing Products,” mimeo, University of California at Davis.

Redding Stephen J and David E Weinstein (2020), "Measuring Aggregate Price Indices with Taste Shocks: Theory and Evidence for CES Preferences," The Quarterly Journal of Economics, 135, 503-560.

Shimomura, K., 1999, "A simple proof of the Sato proposition on non-homothetic CES functions," Economic Theory, 14, 501–503.

• '+1' for reference the Redding paper, insane paper. Been reading it all day. – Jesper Hybel Dec 18 '20 at 23:16
• Just a follow up question: How are you planning to estimate $\beta_{ij}$ and $\sigma(\log p_i - \log p_j)$ in a first step OLS? I mean if you dummies for $(i,j)$-combinations they will capture both $\beta_{ij}$ and $\sigma(\log p_i - \log p_j)$ right? – Jesper Hybel Dec 18 '20 at 23:38
• @Bertrand: Thank you for the answer and the reference. They are very helpful! – Herr K. Dec 19 '20 at 7:42
• @Jesper: I just added clarification on the relationship between $\beta_{ij}$ and the $\alpha_i$ as well as few details on minimum distance. In the best case there are $NT$ observations available for estimating a given $\beta_{ij}$, so OLS is consistent. – Bertrand Dec 19 '20 at 9:19
• What about the theoretically implied constraint $\beta_{ij}+\beta_{jk}=\beta_{ik}$? Vanilla OLS will not handle it by magic. – Konstantin Dec 19 '20 at 13:18

This answer closely follows the logic of estimation of translog cost function presented in Section 4.7 of Fumio Hayashi's "Econometrics".

Define for convenience the CES aggregate price index $$P:=(\sum_i \alpha_i^\sigma p_i^{1-\sigma})^\frac{1}{1-\sigma}$$. Then the Marshallian demand system in log form can be written as a system of linear equations

$$\begin{cases} \ln x_1 &= \ln \alpha_1^\sigma -\sigma\ln p_1 - (1-\sigma)\ln P + \ln M\\ ...\\ \ln x_n &= \ln \alpha_n^\sigma -\sigma\ln p_n - (1-\sigma)\ln P + \ln M. \end{cases}$$

Note that we are dealing with a multiple regression model. If we estimate these equations separately, data will necessarily make estimates of $$\sigma$$ vary depending on the equation we estimate, therefore, we have to impose the common coefficient restriction from the start.

Further, a regression model necessarily needs error terms:

$$\begin{cases} \ln x_1 &= \ln \alpha_1^\sigma -\sigma\ln p_1 - (1-\sigma)\ln P + \ln M + \epsilon_1\\ ...\\ \ln x_n &= \ln \alpha_n^\sigma -\sigma\ln p_n - (1-\sigma)\ln P + \ln M + \epsilon_n. \end{cases}$$

The error terms $$\epsilon_i$$ must have an economic interpretation for us to understand the statistical properties of chosen estimators. In other words, the uncertainty expressed in $$\epsilon_i$$ must be attributed either to $$\alpha_i$$ or to $$\sigma$$ (assuming $$x_i,p_i,M$$ are free of measurement/observation errors).

The most accessible and common interpretation goes as follows :

In reality the weights $$\tilde \alpha_i$$ are not constant across individuals, but may fluctuate a little around the population average $$\alpha_i$$, with $$\epsilon_i\sim\mathcal{N}(0,\sigma_\epsilon^2)$$ being a proxy for this noise: $$\tilde \alpha_i = \exp(\epsilon_i/\sigma) \alpha_i.$$

Replacing $$\alpha_i$$ by $$\tilde \alpha_i$$ in the initial Marshallian demand system and taking logarithms gives exactly the stated regression equation system.

Remark: relating $$\epsilon$$ to the cross-sectional differences in $$\sigma$$ makes things more complicated, as in this case we get heteroskedasticity of the error term in the regression (after taking logarithms, the error term is necessarily multiplied by some function of $$p_i$$).

Now, another problem is that without knowledge of $$\alpha_i,\sigma$$, $$P$$ is not really observed. This problem is solved by subtracting equation $$j$$ from equation $$j$$, as suggested in the answer by @Bertrand. We get a smaller system of equations ($$n(n-1)/2$$ against $$n$$ in the beginning):

$$\ln \frac{x_i}{x_j} = \sigma \ln \frac{\alpha_i}{\alpha_j} -\sigma\ln \frac{p_i}{p_j} + \epsilon_i - \epsilon_j,\quad \forall i\in\{1,..n\}, j\in\{1,..n\}\setminus \{i\}$$

Now this new multiple regression model has two new restrictions besides the common coefficient inherited from the original one:

1. correlated error terms, as $$\mathbb{Cov}(\epsilon_i-\epsilon_j,\epsilon_j-\epsilon_k) = -\mathbb{V}(\epsilon_j)$$,
2. consistency restiction on pair effects: $$\ln{\alpha_i/\alpha_j}+\ln{\alpha_j/\alpha_k} = \ln{\alpha_i/\alpha_k},\quad \forall i\neq j\neq k$$

Correlation in the error terms is not a problem for consistency, but it certainly affects your estimate of the covariances and confidence intervals.

Pair effect consistency on the other hand allows us to reduce the number of coefficients to estimate at the model formulation stage.

In vector form our multivariate regression can be represented as

$$y_t = Z_t \delta + u_t$$

where (for $$n=3$$ without loss of generality)

$$y_t = \begin{bmatrix} \ln(\frac{x_{1t}}{x_{2t}}) \\ \ln(\frac{x_{1t}}{x_{3t}}) \\ \ln(\frac{x_{2t}}{x_{3t}})\end{bmatrix},\quad Z_t = \begin{bmatrix} 1 & 0 & &\ln(\frac{p_{1t}}{p_{2t}}) \\ 0 & 1 & & \ln(\frac{p_{1t}}{p_{3t}})\\ -1 & 1 & & \ln(\frac{p_{2t}}{p_{3t}}) \end{bmatrix}, \quad \delta = \begin{bmatrix} \sigma \ln \frac{\alpha_1}{\alpha_2} \\ \sigma \ln \frac{\alpha_1}{\alpha_3}\\ \sigma \end{bmatrix}, u_t = \begin{bmatrix}\epsilon_1-\epsilon_2\\ \epsilon_1-\epsilon_3 \\ \epsilon_2-\epsilon_3\end{bmatrix}.$$

The above system yeilds easily to the random-effects estimation (treated extensively in Section 4.6 of Hayashi).

The estimate of CES elasticity of substitution $$\hat \sigma$$ is obtained directly, whereas $$\hat\alpha_i$$ can be pinned down with some simple normalizaton (e.g. $$\sum_i \alpha_i = 1$$).

• Sure thing, looks nice enough, let me know when you think you are done. Also are you sure the indexation in the matrix offdiagonal $p_jx_j$-terms are correct? Another thing you may consider, is whether you wanna adress some endogeneity concerns. I mean if people wanna do this in practice is it then a good idea? (not part of the original question I know) – Jesper Hybel Dec 18 '20 at 18:08
• Thank you for the answer. I will have to take some time to digest it the panel regression part, since that's not what I normally do on a day-to-day basis. – Herr K. Dec 19 '20 at 7:53
• @JesperHybel I opened my old textbooks and revised the approach. The endogeneity is not a problem. Much care is needed to identify the $\alpha$'s and to achieve efficiency. – Konstantin Dec 20 '20 at 14:26
• @Konstantin looks nice. Now go and enjoy christmas :) – Jesper Hybel Dec 20 '20 at 15:15

In this comment I simply show that

Under certain assumptions the problem is not an estimation problem, there is an exact solution for $$\sigma$$ and a solution for the structural errors $$\alpha_i$$ up to a normalisation.

The demand system considered is described by the Marshall demand function

$$x_k^\star(p,M) = \left(\frac{\alpha_j}{p_j}\right)^{\sigma}\frac{M}{\sum_j p_j^{1-\sigma}\alpha_j^\sigma},$$

which implies that the expenditure shares are given as

$$s_k(p,I) := \frac{p_k x_k^\star(p,I)}{\sum_j p_j x_j^\star(p,I)} = \frac{p_k^{1-\sigma}\alpha_k^\sigma}{\sum_j p_j^{1-\sigma}\alpha_j^\sigma}.$$

I then define $$K(p,\alpha) := \sum_j p_j^{1-\sigma}\alpha_j^\sigma$$ where $$p = (p_1,...,p_N)$$ and $$\alpha := (\alpha_1,...,\alpha_N)$$ and log linearize expenditure shares to get

$$(1) \ \ \ \log s_k = (1-\sigma) p_k + \sigma \log \alpha_k + K(p,\alpha)$$

Single cross section of aggregate data: Given data on $$\{s_k,p_k\}_{k=1}^N$$ this equation can be estimated using OLS under the assumption that $$\mathbb E[p_k,\ln \alpha_k] =0$$.

Consider now the situation where two time periods are observed $$t=1,2$$ and prices are assumed to show some variation while it is assumed $$\alpha$$ the comsumer demand parameters are time constant

$$(1') \ \ \ \log s_{kt} = (1-\sigma) p_{kt} + \sigma \log \alpha_k + K_t(p_t,\alpha),$$

where I have added time index to $$K$$ because the price-vector is varying across time. It is clear that this is a standard two-way fixed effects regression with no good-time specific error term. Using methods of demeaning know from fixed effects estimation methodology one can find the exact solution for $$(1-\sigma)$$.

First take averages over goods to get

$$\frac{1}{N}\sum_k \log s_{kt} = (1-\sigma) \frac{1}{N}\sum_kp_{kt} + \frac{1}{N}\sum_k \sigma \log \alpha_k + K_t(p_t,\alpha),$$

substract from equation (1) to get

$$(2) \ \ \ \ ds_{kt} = (1-\sigma) dp_{kt} + \sigma d\alpha_k,$$ where the $$d$$ in from of the variable simply signifies it has been demeaned in log-version so $$ds_{kt} := \log s_{kt} - \frac{1}{N}\sum_k \log s_{kt}$$.

Second take first differences over time to get

$$(3) \ \ \ \ ds_{k2} - ds_{k1} = (1-\sigma) [dp_{k2} - dp_{k1}]$$

such that

$$(4) \ \ \forall k: \ \ \ (1-\sigma) = \frac{ds_{k2} - ds_{k1}}{dp_{k2} - dp_{k1}}$$

having found $$\sigma$$ one can find $$\alpha_i$$'s using equation (2). This means that one has to solve for $$d\alpha_k = \alpha_k$$ under normalisation that $$\frac{1}{N}\sum_k \log \alpha_k = 0$$. So the average of the structural errors cannot be recovered.

Under the assumption that $$\alpha_k$$'s are time invariant one with data $$\{p_{jt},s_{jt}\}_{j=1,...N, t=1,2}$$ recover $$\sigma$$ using exactly using (4) and the structural errors $$\alpha_k$$ up to a single normalization using (2).

To illustrate the calculations I provide a small simulation:

#set.seed(1)
N <- 50
M <- 100000
sigma <- 4

# Simulate structural errors assumed time-constant
phi <- 2*runif(N)+2
phi <- phi/((prod(phi))^(1/N))

# Simulate prices
p1 <- 2*runif(N)+2
p2 <- 2*runif(N)+2

s1 <- (p1/phi)^(1-sigma)
s1 <- s1/sum(s1)
E1 <- M*s1

s2 <- (p2/phi)^(1-sigma)
s2 <- s2/sum(s2)
E2 <- M*s2

x1 <- E1/p1
x2 <- E2/p2

library(data.table)
dt <- data.table(good=rep(1:N,2),time=rep(c(1,2),each=N),price=c(p1,p2),x=c(x1,x2))
dt[,E:=sum(price*x),by=time]
dt[,share:=price*x/E]

dt[,ds:=log(share)-mean(log(share)),by=time]
dt[,dp:=log(price)-mean(log(price)),by=time]
1-coef(lm(ds~dp+as.factor(good),data=dt))[2]
1-coef(lm(log(share)~log(price)+as.factor(good)+as.factor(time),data=dt))[2]
sigma

# Or from a single instead of all N
temp <- as.matrix(dt[good==2,.(ds,dp)])
1-(temp[2,1] - temp[1,1]) / (temp[2,2]-temp[1,2])


The calculations in this post are based on Stephen J. Redding and David E. Weinstein paper A UNIFIED APPROACH TO ESTIMATING DEMAND AND WELFARE.

• There's a thing called overfitting. It will cause your third period observations be soo not in line with obtained parameter values. – Konstantin Dec 20 '20 at 18:16
• The point is simply to show that as the model is written up there is an exact solution if you have more than one time period. This has nothing to do with overfitting. A more fitting term would be overidentification. – Jesper Hybel Dec 20 '20 at 18:25
• The point of my comment is just to say, that if we have a dataset $\{x^1_t,..,x^n_t,y_t \}_{t=1}^T$ and we want to pick some values for $a,b^1,..b^n$ to fit a linear relation $y_t = a + \sum b^i x^i$ then we can always throw away any $T-n-1$ observations and make a system of linear equations of the rest. But that does not mean that the datapoints you threw away will satisfy the same equation. The values you get will not be robust. Call it what you like, "too many parameters, too little data". – Konstantin Dec 20 '20 at 18:53
• Im sorry i don't follow your example is there no $n$ index on your $y$? And then there is $t$ index in the data but none in the fitting model you fit?? I fail to see the analogue. There is no data thrown away any where. And there is no overfitting because you are not supossed to read it as estimation method. I thought that would be clear from the introduction of the post. – Jesper Hybel Dec 20 '20 at 19:18

These other answers seem to be citing some methods I haven't quite heard about yet however they all touch upon the idea developed by Czech economist named Jan Kmenta which has come to be known as the Kmenta approximation (an in depth explanation as well as detailed derivation can be found in the documentation of the R package,MicEconCES.

A general form of a CES utility function is:

$$u(x_1,...,x_n)=\gamma\left(\sum_i \delta_i x_i^{-\rho}\right)^\frac{v}{\rho}$$

To estimate this we have: $$\ln y=\alpha_0+\sum_i\alpha_i \ln x_i+\frac{1}{2}\sum_i\sum_j \beta_{ij}\ln x_i \ln x_j$$ where $$y$$ is our index of utility (note that we can recover an organic index of utility through estimating an expenditure system and using our principles of duality).

To obtain the parameters of the CES function we have the following forms: $$\gamma=\exp(\alpha_0)$$ $$v=\sum_i\alpha _i$$ $$\delta_i=\frac{\alpha_i}{\sum_i \alpha_i}$$ $$\rho=\frac{\beta_{ij}}{\alpha_i \alpha_j}\sum_i \alpha_i \ \ \forall i,j$$

I'd heavily recommend using the R package for any empirical work you may be doing. Hope this helps.

• Interesting. Hope you get the time to perhaps expand a little on what kind of data is used. I'm not sure I follow what $y$ is and how it becomes measurable so to say. – Jesper Hybel Dec 21 '20 at 0:40
• Interesting, but not an answer to the original post, comment at best. Only useful when the output of the CES is observed, which is only the case for CES production function. It is stated explicitly in the post that the production function estimation is not the goal here. – Konstantin Dec 21 '20 at 21:33
• @Konstantin you can obtain y after estimating and expenditure system and inverting it to obtain our index of utility. – EconJohn Dec 21 '20 at 23:43
• @EconJohn It looks like estimating the expenditure system is the crucial part here. Moreover, estimating the expenditure system shall already give us the estimates of $\alpha_i,\sigma$. If I understand correctly, you suggest 0) estimating the expenditure system somehow and getting parameter estimates, 1) constructing a CES aggregate based on parameter estimates, and then 2) re-estimating the same parameters through Kmenta approximation based on this CES aggregate. What are the advantages of this approach? – Konstantin Dec 22 '20 at 9:05