* A Nonparametric Average Cost Function
*
* Keywords:
* regression, nonparametric, average cost, plot
*
* Description:
* We illustrate how to estimate a model for Average Costs in Electricity
* Supply industry nonparametrically
* and plot it
*
* Author(s):
* Noel Roy
* Skif Pankov
*
* Source:
* William H. Greene, Econometric Analysis - 7th Edition
* Pearson International Edition, Chapter 7, Example 7.12 (page 254)
*
* Reading the data and naming variables
read (TableF4-4.shd) id year cost output
* Sorting the data in output order
sort output cost
sample 6 140
* Generating average cost
genr ac=cost/output
* Smoothinh the effect of output on average cost using kernel extimation
* and saving the predicted values in a vector achat
nonpar ac output / predict=achat
* Replicating figure 7.8
graph ac achat output
* replicating figure 7.9 by setting the bandwidth to 0.04
nonpar ac output /predict=achat smooth=0.04
* Replicating figure 7.9
graph achat output /lineonly
stop