Translog Cost Function EstimationÂ¶
This post focuses on the translog cost function. I discuss the linear homogeneity constraint, the technique to impose the constraint, and its estimation via
 Ordinary Least Square (OLS)
 Stochastic Frontier Analysis (SFA)
Code examples are provided, too.
Translog Cost FunctionÂ¶
The translog cost function is used to approximate potentially very complex cost functions, and hence complex underlying production functions due to the duality between production maximization and cost minimization.
In a general form, the translog cost function \( \ln C(Q, W) \) as a function of output \( Q \) and a vector of \(n\) input prices \( W \) is represented as
Linear Homogeneity ConstraintÂ¶
In economic theory, a cost function is often assumed to be linearly homogeneous in input prices. This means that if all input prices \( W_i \) are scaled by a constant \( \lambda > 0 \), the total cost \( C \) should also scale by the same constant \( \lambda \). Mathematically, this is expressed as:
Linear homogeneity is an important property because it ensures that the cost function is consistent with the idea of constant returns to scale in prices.
Implications for parametersÂ¶
If we take the total differential of the log cost, holding output constant, we have,
By assumption, all input prices scale by the same factor \(\lambda\) so that \(d\ln W_i\) is the same across all \(n\) inputs. Therefore, we can factor it out, which gives,
To ensure \(\frac{d\ln C}{d\ln \bar{W}}=1\) hence linear homogeneity in the translog cost function, the following conditions must be met:
By imposing these constraints, we ensure that the estimated translog cost function is linearly homogeneous in input prices, which is a desirable property from both a theoretical and empirical standpoint.
Do NOT forget to impose the constraint!
Zardkoohi, Rangan, and Kolari (1986) published a 3page paper on the Journal of Finance, essentially pointing out that some previous studies estimating translog cost functions forgot to impose the linear homogeneity constraint...
Technique to Impose Linear Homogeneity ConstraintÂ¶
But thankfully we have an easy technique to avoid constrained optimization.
Scaling the cost \( C \) and input prices \( W_i \) by one of the input prices, say \( W_1 \), is a common technique to impose the linear homogeneity constraint in translog cost functions. The scaled version of the translog cost function can be written as:
Why does it satisfies linear homogeneity? Let me work it out one by one.
First, \(\sum \gamma = 1\)Â¶
We can manipulate \(\eqref{eq:scaledtranslogcost}\) a bit and find that,
Clearly, the sum of coefficients of \(\ln W_i\) is 1, satisfying the linear homogeneity requirement \(\eqref{eq:linearhomogeneityreq1}\).
Second, \(\sum \phi = 0\)Â¶
Focusing the part \(\sum_{i=2}^{n} \phi_i \ln Q \ln \left(\frac{W_i}{W_1}\right)\) in \(\eqref{eq:scaledtranslogcost}\), we can find that,
Clearly, the sum of coefficients of the crossterms \(\ln Q \ln W_i\) is 0.
Third, \(\sum \theta = 0\)Â¶
By the same rationale as above, we should be able to prove it as well. I didn't manually verify, but it should work out as expected.
Tip
In summary, by using this scaling technique, we can estimate the translog cost function in a way that automatically satisfies the linear homogeneity constraints, making the estimation process more efficient.
Constrained optimization is difficult... Mingze (2023)
OLS or SFA? Efficiency ConsiderationÂ¶
Now that we've established that we can estimate Equation \(\eqref{eq:scaledtranslogcost}\) to ensure linear homogeneity constraint. Given a firmyear panel, we can simply estimate the following model:
where \(m\) indexes the firm, \(t\) represents time. \(\tilde{C}_{mt}=\frac{C_{mt}}{W_{1mt}}\) and \(\tilde{W}_{imt}=\frac{W_{imt}}{W_{1mt}}\) are the scaled total costs and input prices.
We can of course use OLS to estimate \(\eqref{eq:modeltoestimate}\). However, this approach means that we do not accounting for differences in efficiency among different firms. Specifically, OLS assumes that the error term (\(\epsilon_{mt}\)) in \(\eqref{eq:modeltoestimate}\) is just random noise.
On the other hand, we can model \(\epsilon_{mt}=v_{mt}+u_{mt}\) such that random error \(v_{mt}\) is i.i.d. normal with mean zero and variance \(\sigma^2_{v}\). The \(u_{mt}\) term denotes the systematic deviations from the optimal cost due to inefficiency. \(u_{mt}\) can be modeled to be i.i.d. halfnormal and variance \(\sigma^2_{u}\) independent of \(v_{mt}\). This approach is basically a Stochastic Frontier Analysis (SFA), which can be estimated via MLE. An influential example is Koetter, Kolari, and Spierdijk (2012).
SFA: pooled or panel?
There are many further considerations when applying SFA, for example, whether a pooled "crosssectional" SFA or a panel SFA. The former assumes a single efficient frontier for all firmyears, while the latter assumes a timevarying frontier. Moreoever, in a panel SFA, we can further assume a timeinvariant firm inefficiency, or a timedecaying firm inefficiency.
Based on my limited reading, it seems that the literature typically does not use panel SFA. I do not attempt to discuss which one to use, but will provide code examples for all.
Trend or Time Fixed EffectsÂ¶
In the literature, it is also very common to include either trend or time fixed effects in model \(\eqref{eq:modeltoestimate}\).
If we include trend, the model to estimate is:
If we include time fixed effects, the model to estimate is:
A Note on Marginal CostÂ¶
The marginal cost for bank \( m \) at time \( t \) is then obtained as
ReferencesÂ¶

Beck, De Jonghe, and Schepens (2013) Bank competition and stability: Crosscountry heterogeneity, Journal of Financial Intermediation, 22 (2), 218â€“244.

Berger, Klapper, and TurkAriss (2009) Bank Competition and Financial Stability, Journal of Financial Services Research, 35, 99â€“118.

Koetter, Kolari, and Spierdijk (2012) Enjoying the Quiet Life under Deregulation? Evidence from Adjusted Lerner Indices for U.S. Banks, Review of Economics and Statistics, 94 (2), 462â€“480.

Shaffer and Spierdijk (2020) Measuring multiproduct banks' market power using the Lerner index, Journal of Banking & Finance, Volume 117, August 2020, 105859.

Zardkoohi, Rangan, and Kolari (1986), Homogeneity Restrictions on the Translog Cost Model: A Note, The Journal of Finance, 41 (5), 11531155.
Code ExamplesÂ¶
Here I demonstrate how to estimate translog function for banks. Specifically, I start with the bankyear data from BankScope downloaded via WRDS.
keep if ctrycode == "US"
keep if special == "Commercial banks"
// Use yearend data
keep if closdate == mdy(12, 31, year(closdate))
keep if 2015<=year(closdate) & year(closdate)<=2020
// Unit can be "0", "th", etc.
// Most credit unions use "0" unit; Commercial banks use "th" (thousands)
keep if unit == "th"
// C1: statement of a mother bank integrating the statements of its controlled
// subsidiaries or branches with no unconsolidated companion
keep if consol == "C1"
gen year = year(closdate)
encode bvdidnum, gen(bvdid)
xtset bvdid year
rename data91100 total_assets
rename data72500 staff_expenses
rename data72800 total_operating_expenses
rename data72700 other_operating_expenses
rename data72600 other_admin_expenses
rename data91300 total_customer_deposits
rename data82450 total_interest_customer_deposits
gen Q = total_assets
gen C = total_operating_expenses
gen W1 = staff_expenses / total_assets
gen W2 = total_interest_customer_deposits / total_customer_deposits
gen W3 = (other_operating_expenses+other_admin_expenses) / total_assets
winsor2 Q C W1 W2 W3, cut(1 99) replace
// Scale cost and input prices
gen C_s = C / W1
gen W2_s = W2 / W1
gen W3_s = W3 / W1
gen logQ = log(Q)
gen logC = log(C_s)
gen logW2 = log(W2_s)
gen logW3 = log(W3_s)
Now it comes to the estimation. In some cases, like the one below with time fixed effects, Stata may fail to start the MLE process with an error "initial values not feasible".
According to this Stata mail list, the reason is because Stata uses a method of moments estimator to find the starting values for MLE. For some datasets, especially those with almost no inefficiency effect, these starting values will not be feasible.
The solution, as I summarize, is to supply the starting values using from()
(for halfnormal or exponential models) or ufrom()
(for truncatednormal model). Specifically,
 Use a simple linear regression to get starting values for the coefficients.
 Use the natural log of the square of RMSE as the starting value for lnsig2v parameter, the natural log of variance of the idiosyncratic error.
 Use a small positive number, say .1, as the starting value for the lnsig2u parameter, the natural log of the variance of the log of the inefficiency term.
// A simple linear regression
global rhs = "c.logQ##(c.logQ c.logW2 c.logW3) c.logW2#c.logW3 i.year"
regress logC ${rhs}
// matrix b0_hnormal is [b..., lnsig2v, lnsig2u]
matrix b0_hnormal = e(b), ln(e(rmse)^2) , .1
Then, estimate SFA with the given starting values b0_hnormal
. I additionally specify options difficult
to automatically switch optimization algorithm. iter
option may be used to limit the maximum number of iterations.
This time the estimation successfully complete. We can compute the margin cost MC as
If we use trend model instead, the above becomes
gen trend = year  2015
global rhs = "c.logQ##(c.logQ c.logW2 c.logW3) c.logW2#c.logW3 c.trend c.trend#c.trend c.trend#c.logQ c.trend#(c.logW2 c.logW3)"
regress logC ${rhs}
// matrix b0 is [b..., lnsig2v, lnsig2u]
matrix b0_hnormal = e(b), ln(e(rmse)^2) , .1
frontier logC ${rhs}, cost from(b0_hnormal, copy) dist(hnormal) difficult iter(25)
gen MC_trend = C/Q * (_b[logQ] + 2*_b[logQ#logQ]*logQ + _b[logQ#logW2]*logW2 + _b[logQ#logW3]*logW3 + _b[trend#logQ]*trend)
In this case, MC
and MC_trend
have a correlation of 1.0, so the two models (time fixed effects and trend) are basically the same.
Panel SFA can be done via xtfrontier
in Stata (xtfrontier
assumes truncatednormal).
global rhs = "c.logQ##(c.logQ c.logW2 c.logW3) c.logW2#c.logW3"
regress logC ${rhs}
// matrix b0_xtfront is [b..., lnsigma2, lgtgamma, mu]
// see Stata help xtfrontier for the meaning of the params
matrix b0_xtfront = e(b), ln(e(rmse)^2) , .1 , .1
xtfrontier logC ${rhs}, cost ti from(b0_xtfront, copy) difficult iter(25)
Note that with panel SFA, the ti
option specifies a timeinvariant firm inefficient. Yet the inefficiency estimate is again highly correlated with the pooled SFA.