* OLS ANOVA Model for Airlines' Production Efficiency
*
* Keywords:
* regression, ols, log, anova, dummy, airlines, efficiency, production, f-test,
* plot
*
* Description:
* We illustrate how to estimate a log Multiple OLS model for the Production
* Efficiency of Airlines, conduct Analysis of Variance in order to underpin
* potential time and firm effects, construct F-tests to assess the significance
* of these effects and create a plot
*
* Author(s):
* Noel Roy
* Skif Pankov
*
* Source:
* William H. Greene, Econometric Analysis - 7th Edition
* Pearson International Edition, Chapter 6, Example 6.4 (page 193)
*
* Reading the datafile and naming the variables, specifying to ignore the
* first line of the file
read (TableF6-1.shd) i t c q pfuel loadfact / skiplines=1
* Generating new variables
genr lnc=log(c)
genr lnq=log(q)
genr lnq2=lnq**2
genr lnpf=log(pfuel)
* Creating dummies that represent the time and firm effects. A do command
* creates 14 time dummies, named d1, d2, ... d14, using the dum function,
* which has a value of 1 when its argument is positive and 0 otherwise.
* Similarly, five firm dummies f1, f2, . . .f5 are created
set nodoecho
do #=1,14
genr d#=dum(1-(t-#)**2)
endo
do #=1,5
genr f#=dum(1-(i-#)**2)
endo
* Running an OLS model of lnc on lnq, lnq2, lnpf, loadfact and all generated
* dummies (please note the syntax used to include all numbered dummies),
* specifying to save estimated coefficients as a vector b
ols lnc lnq lnq2 lnpf loadfact d1-d14 f1-f5 / coef = b
* Testing the time effects model; our null is that there are no firm effects
* present
test
test f1
test f2
test f3
test f4
test f5
end
* Testing the firm effects model; our null is that there are no time effects
* present
test
test d1
test d2
test d3
test d4
test d5
test d6
test d7
test d8
test d9
test d10
test d11
test d12
test d13
test d14
end
* Testing for the absence of either firm or time effects
test
test d1
test d2
test d3
test d4
test d5
test d6
test d7
test d8
test d9
test d10
test d11
test d12
test d13
test d14
test f1
test f2
test f3
test f4
test f5
end
* Replicating figure 6.1; the year dummy variables are stored as elements
* 5-18 of vector b, the vector of coefficients saved in the ols command
* (elements 1-4 are the coefficients of the variables lnq lnq2 lnpf and
* loadfact
sample 5 18
genr year=time(-4)
graph b year /nokey
stop