* Nonlinear Cost Function in the US electric power industry
*
* Keywords:
* regression, ols, log, nerlove, cobb-douglas, cost, function, electric power, us,
* f-test, plot
*
* Description:
* We illustrate how to estimate a log-linear Cost Function, used by Nerlove
* in his study of economies of scale in the U.S. electric power industry, by OLS
* with restrictions, how to conduct f-tests on coefficients of the model and how
* to plot a graph
*
* Author(s):
* Noel Roy
* Skif Pankov
*
* Source:
* William H. Greene, Econometric Analysis - 7th Edition
* Pearson International Edition, Chapter 6, Example 6.6 (page 202)
*
sample 1 145
* Reading the datafile and naming the variables, specifying to ignore the
* first 2 lines of the file
read (TableF6-2.shd) firm year costs kwh pl sl pk sk pf sf / skiplines=2
* Generating logs of variables
genr lncosts=log(costs)
genr lnkwh=log(kwh)
genr lnpl=log(pl)
genr lnpf=log(pf)
genr lnpk=log(pk)
* Running an OLS regression of lncosts on lnkwh, lnpl, lnpf and lnpk with
* restrictions (the sum of coefficients on lnpl, lnpf and lnpk must be 1),
* also specifying that it's a log-log regression and to save estimated
* coefficients and residuals into separate vectors
ols lncosts lnkwh lnpl lnpf lnpk / loglog restrict coef=beta resid=err
restrict lnpl+lnpf+lnpk=1
end
* Computing the confidence interval of the estimated coefficient on lnkwh
confid lnkwh
* Testing hypotheses on returns to scale and price terms (that the coefficent
* on lnkwh is equal to 1)
test lnkwh=1
* Computing asymptotic significance test for alpha2 = beta2/betay
test lnpk/lnkwh
* Computing returns to scale parameter 1/betay
gen1 1/beta(1)
* Generating a plot of residuals
graph err lnkwh /nokey
* Repeating the estimation for each of 5 groups of 29 firms by running a
* do loop, which first selects the relevant part of the sample (the data are
* presorted by output) and then runs an OLS regression with restiction
* similar to the one above
set doecho
do #=1,5
gen1 beg=(#-1)*29+1
gen1 end=#*29
sample beg end
ols lncosts lnkwh lnpl lnpf lnpk / loglog restrict coef=beta#
restrict lnpl+lnpf+lnpk=1
end
* Computing returns to scale parameters
gen1 1/beta#(1)
endo
* Introducing the quadratic term
sample 1 145
genr lnysq=lnkwh**2
ols lncosts lnkwh lnysq lnpl lnpf lnpk / loglog restrict coef=beta
restrict lnpl+lnpf+lnpk=1
end
* Testing for constant returns to scale
test
test lnkwh=1
test lnysq=0
end
* Calculating returns to scale parameter for the median firm in each
* subsample
do #=1,5
gen1 1/(beta(1)+2*beta(2)*lnkwh(15+29*(#-1)))
endo
stop