Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION...

60
Maximum-Likelihood Estimation of Stochastic Frontier Production Functions with Time-Varying Technical Efficiency using the Computer Program, FRONTIER Version 2.0. ~. J. Coelli No. 57 - October 1991 ISSN 0_157-0188 ISBN 0 85834 975 2

Transcript of Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION...

Page 1: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Maximum-Likelihood Estimation of

Stochastic Frontier Production Functions

with Time-Varying Technical Efficiency using

the Computer Program, FRONTIER Version 2.0.

~. J. Coelli

No. 57 - October 1991

ISSN 0_157-0188

ISBN 0 85834 975 2

Page 2: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood
Page 3: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Maximum-Likelihood Estimation of Stochastic Frontier Production

Functions with Time-Varying Technical Efficiency using the Computer

P~ogram, FRONTIER Version 2.0

by

T. J. Coelll

Department of Econometrics

University of New England

Armidale, NSW, 2351

Australia

Maximum-likelihood estimation of the parameters of a stochastic

frontier production function can be a time consuming task. This

paper describes a computer program which has been written to provide

estimates of the parameters of the model set out in Battese and

Coe!li (1991). This stochastic frontier production function

considers unbalanced panel data with firm effects that are

distributed truncated normal and are permitted to vary across time.

The computer program permits the estimation of many other models

which have appeared in the literature through the imposition of

simple restrictions. A three-step method is used to calculate

parameter estimates. Asymptotic estimates of standard errors are

calculated along with individual and mean estimates of technical

efficiency. A short example illustrates the use of the computer

program.

Page 4: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood
Page 5: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

I. INTRODUCTION

This paper describes the computer program, FRONTIER, which has

been written to obtain maximum likelihood estimates for parameters

of a wide variety of stochastic frontier production function models.

The paper is divided into sections. Section 2 describes the

stochastic frontier production function of Battese and Coelli (1991)

and notes the many special cases of this formulation which can be

estimated. Section 3 describes the FRONTIER program and Section 4

provides a short example. Some final points are made in Section 5.

Two appendices are added, the first summarises key points on the use

of the program and also provides a brief explanation of the purposes

of each subroutine, while the.second appendix contains a listing of

the Fortran 77 code.

2. MODEL SPECIFICATION

The stochastic frontier production function, independently

proposed by Aigner, Lovell and Schmidt (1977) and Meeusen and van

den Broeck (1977), has spawned a body of theoretical and applied

literature which is expanding exponentially. I do not attempt to

revie~ this literature, but simply refer the reader to the many

comprehensive reviews which are available, such as Forsund, Lovell

and Schmidt (1980), Schmldt (1986), Bauer (1990) and Battese (1991).

The extensive bibliographies of frontier modellihg and efficiency

analysis provided by Ley (1990) and Beck (1991) may also be of

interest.

Page 6: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

The computer program, FRONTIER, provides maximum-likelihood

estimates of the stochastic frontier production function set out in

Battese and Coelli (1991).

Yit = f(Xit;~) ¯ e (V1t-Uit) ,i=l ..... N, t=l .....

where Y~t is the production of the i-th firm in the t-th time

period,

f(.) is a suitable function (for example the Cobb-Douglas),

X~t is the k by I vector of input quantities of the i-th firm in

the t-th time period,

~ iS a k by I vector of unknown parameters,

are i.i.d. N(O,~ve),

Uit = (U~.e-n(t-T)), where n is an unknown parameter and

Ui are i.i.d, positive truncations of the N(~,~2) distribution,

and the panel of data need not be complete.

We utilise the parameterization of Battese and Corra (1977) who

replace ~v2 and ~2 with ~Sa=~rV2+~2 and ~=~2/(~v2+~2). This is done

with the calculation of the maximum-llkellhood estimates in mind.

The parameter, y, must lie between 0 and I and thus this range can

be searched to provide a good starting value for an iterative

maximization process.

The imposition of one or more restrictions upon this model

formulation can provide a number of the special cases of this

particular model which have appeared in the literature. Setting W to

be zero provides the time-invariant model set out in Battese, Coelli

and Colby (1989). Furthermore, restricting the formulation to a full

(balanced) panel of data gives us the model of Battese and Coelli

(1988) and Hughes (1988). The additional restriction of ~ equal to

4

Page 7: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

zero reduces the model to Model I in Pitt and Lee (1981). One may

add a fourth restriction of T=I to return to the original

formulation of Aigner, Lovell and Schmidt (1977). Obviously a large

number of permutations exist. For example, if all these restrictions

except ~=0 are imposed, then the model suggested by Stevenson (1980)

is obtained.

FRONTIER can estimate all of the above-mentioned models. If the

user is unsure as to which formulation is most applicable to a

particular study, it is recommended that a number of these models be

estimated and that a prefered model be selected using likelihood-

ratio tests. One can also test whether any form of stochastic

frontier production function is required at all by testing the

significance of ~. If the null hypothesis, that ~ equals zero, is

accepted, then the ordinary least-squares model would be prefered

over a stochastic frontier production function.

3. THE FRONTIER PROGRAM

Version 2.0 of FRONTIER is substa~tlally different from the

first version documented in Coelll (1989). The major differences are

as follows.

- Time-varying technical efficiency is considered.

- Interactive use is now permltted as well as batch use.

- The code has been written for Lahey Fortran 77 for use on a

640k IBM compatible PC.

- The code is distributed on a 360k diskette and includes both

the source code as well as a compressed executable file.

- A number of key values such as convergence criterion and

iteration limits may be altered without recompiling the code.

This is achieved by editing a start-up file named FRONT2.000.

- Numerous small improvements to the code have been made,

including the correction of a few minor bugs.

Page 8: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

The program is designed to estimate a Cobb-Douglas production

function in logarithms.

,i=l ..... N, t=l ..... T,

where k refers to the number of inputs and all other notation is as

defined previously..

3.1 FILES NEEDED

The execution of FRONTIER Version 2.0 on an IBM PC generally

involves five files:

1) The executable file, FRONT2.EXE

2) The start-up file, FRONT2.000

3) A data file (for example, called test.dta)

4) An instruction file (for example, called test.ins)

5) An output file (for example, called test.out).

The start-up file, FRONT2.000, contains values for a number of

key variables such as the convergence criterion, printing flags,etc.

This text file may be edited if the user wishes to alter any values.

This file is discussed further in Appendix A. The data and

instruction files must be created prior to execution. The output

file is created by FRONTIER during execution. [Note: A model can be

estimated without an instruction file if the program is used

interactively.] Examples of a data, instruction and output files are

listed in Tables I, 2 and 3 in the following section.

Page 9: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

The program requires that the data be held in an ASCII file and

is quite particular about the format. The data must be listed by

observation. There must be k+3 columns presented in the following

order:

1)2)3)

4)

k+3)

Firm number (an integer in the range 1 to N)

Period number (an integer in the range 1 to T)

Ylt

X11t

:

Xklt

Note that the data must be in original units because the program

calculates the logarithms of the output and input data for the

estimation of a Cobb-Douglas production function in logarithmic

form. The inclusion of any zero or negative numbers in the data will

cause the program to stop.I The observations can be listed in any

order but the columns must be in the stated order. There must be. at

least one observation on each of the N firms and there must be at

least one observation in time period I and in time period T.

As noted earlier, the program can receive instructions either

from a file or from a terminal. After typing "FRONT2" to begin

execution the user is asked whether instructions will come from a

file or the terminal. The structure of the instruction file is

listed in the next section. If the interactive (terminal) option is

selected, then questions will be asked in the same order as they

appear in the instruction file.

1Functional forms other than Cobb-Douglas may be estimated if the user can ’trick’the program into estimation through suitable transformation of the data columnsprior to inclusion in the data file.

Page 10: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Because FRONTIER Version 2.0 was written so that it would run on

an IBM PC with 640k RAM, the program now has tighter size limits

than previously was the case. The limits are:

I00 cross-sections,

20 time periods,

16 regresssor variables (including the constant) and hence 20

parameters.

The code has been rewritten so that these values may be easily

altered if the computer on which FRONTIER is loaded has larger (or

smaller) limits. The line:

"PARAMETER(KI=I00,K2=20,K3=I6,K4=K3+4)"

now appears in many program units in the code. The ’search and

replace’ command in your text editor will permit you to alter this

line throughout the program in only a few seconds. The code would

then need to be recompiled prior to execution.

3.2 TKE THREE-STEP ESTIMATION METHOD

The program will follow a three-step procedure in estimating the

maximum-likelihood estimates of the parameters of the stochastic

frontier production function.2 The three steps are:

I) Ordinary Least-Squares (OLS) estimates of the production

function are obtained. All 8 estimators with the exception of

the intercept are unbiased.

2) A two-phase grid search of the y, g and n parameters is

conducted with the 8-parameters (excepting 8o) set to the OLS

values and the 8o and ~s2 parameters suitably adjusted.

3) The values selected in the grid search are used as starting

values in an iterative procedure using a Quasi-Newton method

which obtains the final (approximate) maximum-likelihood

estimates.

21f starting values are specified in the instruction file, the program will skip thefirst two steps of the procedure.

8

Page 11: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

3.2. I GRID SEARCH

As mentioned earlier a grid search is conducted across the three

parameters, ~, ~ and W, if no restrictions are imposed upon the

model. The values of ~o and ~s2 are adjusted accordingly during this

grid search. With a large data set and a slow computer the grid

search may take a number of minutes of computing time to complete.

The values of the variables, GRIDNO and GWIDTH, which specify the

extent of the grid Search are listed in the start-up file,

FRONT2.000. The grid search is as follows:

from 0. I to 0.9 in steps of GRIDNO

from -2.~ois to 2.~ois in steps of 2.~ols. GRIDNO

from -GWIDTH to GWIDTH in steps of 2.GWIDTH.GRIDNO

where ~ols is the standard error of the OLS regression conducted in

step (I) and the values of GRIDNO and GWIDTH are set in the file

FRONT2.0CO to:

GRIDNO = 0. I

GWIDTH = 1.0.

These values may be altered by the user if desired.

With the above values the grid search will involve (9 by II by

II) = 1089 function evaluations. If the width of the search on n is

altered (by changing GWIDTH) this will not affect the number of

function evaluations conducted. If the size of the steps are altered

(by changing GRIDNO), then the number of function evaluations will

change. For example, reducing GRIDNO from 0. I to 0.05 will result in

(17 by 21 by 21) = 7497 function evaluations. Hence reducing GRIDNO

by half has resulted in approximately (2 by 2 by 2) = 8 times the

number of function evaluations in the grid search. If ~ and/or n are

restricted to be zero the number of function evaluations in the grid

search will be reduced substantially.

9

Page 12: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

If the variable, IGRID2, in FRONT2.000 is set to I (instead of

O) then a second-phase grid search will be conducted around the

values obtained in the first phase. The width of this grid search on

all three parameters will be GRIDNO/2 either side of the first-phase

estimates in steps of GRIDNO/5. Hence, there will be an extra (6 by

6 by 6) = 216 function evaluations. The value of IGRID2 may be set

to 0 in FRONT2.000 if the user does not require this extra degree of

accuracy on the grid search.

3.2.2 ITERATIVE MAXIMIZATION PROCEDURE

The first-order partial derivatives of the log-likelihood

function of the stochastic frontier production function are lengthy

expressions. These are presented in the appendix of Battese and

Coelli (1991). Many of the gradient methods of finding maximum-

likelihood estlmat~s, such as the Newton-Raphson method, require the

second partial derivatives to be calculated. Hence we decided to use

Quasi-Newton methods which only require the vector of first partial

derivatives. The Davidon-Fletcher-Powell method was selected as it

appears to have been used successfully in a wide range of

econometric applications and was alsorecommended by Pitt and Lee

(1981). For a general discussion of the relative merits of a number

of Newton and Quasi-Newton methods, see Himmelblau (1972), which

also provides a description of the mechanics (along with Fortran the

code) of a number of the more popular methods. The structure of the

subroutines, MINI, SEARCH, ETA and CONVRG, used in FRONTIER are

taken from the appendix in Himmelblau (1972).

The iterative procedure takes the parameter values supplied by

the grid search as starting values (unless starting values are

supplied by the user). The program then updates the vector of

parameter estimates by the Davidon-Fletcher-Powell method until

either of the following occurs:

a) The convergence criterion is satisfied. The convergence

criterion is set in the start-up file, FRONT2.000, by the parameter,

TOL. Presently it is set such that, if the proportional change in

I0

Page 13: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

the likelihood function and each of the parameters is less than

0.00001, then the iteratlve procedure terminates.

b) The maximum number of iterations permitted is completed. This

is presently set in FRONT2.000 to I00.

Both of these parameters may be altered by the user.

3.3 PROGRAM OUTPUT

The ordinary least-squares estimates, the estimates after the

grid search and the final maximum-likelihood estimates are all

presented in the output file. Approximate standard errors are taken

from the direction matrix used in the final iteration of the

iterative procedure. This approximation of the covarlance matrix is

also listed in the output. If the user is not satisfied with this

matrix, then an alternative covariance matrix, suggested by Berndt,

et al (1974), is calculated. The program uses this alternative

covariance matrix estimator if the IBHHH variable in the start-up

file, FRONT2.000, is set to I.

Estimates of mean and individual technical efflciencies are

calculated according to the expressions presented in Battese and

Coelli (1991). An estimate of technical efficiency is calculated for

each firm in each year. An estimate of the mean iechnical efficiency

of all firms is also be presented for each year. If W is restricted

to be zero then only single estimates of the technical efficiencies

of each firm and a single estimate of mean technical efficiency is

calculated, because technical efficiency is assumed to be time-

invarlant.

11

Page 14: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

4. A SHORT EXAHPLE

To illustrate the use of FRONTIER Version 2.0, a data set has

been generated and saved in the file EGI.DTA. Assumptions about the

true values of the parameters are as follows:

N= 15

T=5total number of observations = 68 (7 discarded arbitrarily)

k=2

XI drawn from a uniform distribution on I-I0

X2 drawn from a uniform distribution on I-I00

= 2.0/~1 =0.3

~2 = O.S~’v2 = O. 04 ¯

~=0.5o‘2 = O. 09

0=0.1.

The values of ~v2 and a~ imply that:

~s~- = ~v2 + ~2 = 0.04 + 0.09 = 0.13

~ = ~2/~s2 = 0.09/0.13 = 0.69.

The data file, EGI.DTA, is listed in Table I. Note that the

columns-are: firm number, time period, Ylt, Xl~t and X21t, from left

to right. We prefer to use FRONTIER in batch mode rather than

interactlvely. Hence, the instruction file, EGI.INS, was constructed

by making a copy of the file, BLANK. INS, and inserting the relevant

information using a text editor. The instruction file, EGI.INS, is

listed in Table 2. The first 9 lines of the file are self

explanatory through the comments on the right-hand side of the

file.1 The names of the data, instruction and output files cannot be

any longer than 12 characters each. Note that on line 7 of the

instruction file it is indicated that ~ is to be restricted to zero.

lit should be mentioned that the comments in BLANK. INS and FRONT2.000 are not readby FRONTIER and hence users may have instruction files which are made from scratchwith a text editor and contain no comments. This is not recommended, however, as itwould be too easy to lose track of which input value belongs on which line.

12

Page 15: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

This has been done because we had earlier estimated 4 forms of the

model and obtained the following log-likelihood values:

Model Restrictions Log-likelihood value

1 ~=0, n=O -12.45

2 n=O -12.03

3 ~=0 -8.26

4 no restrictions -8.03

OLS ~=0, w=O, ~=0 -29.18

Using generalized likelihood-ratio tests with a 5% level of

significance we found that model (3), which had ~ restricted to be

zero, was the prefered model. This chi-square test is always

prefered to an asymptotic t-test because the estimated standard

errors are only approximate.

The output file, EGI.OUT, resulting from this instruction file

having been sent to FRONTIER, is listed in Table 3. The values of

the estimated coefficients may be compared to the values which Were

used to generate the sample. This process can obviously be repeated

for a number of randomly generated samples to form a monte carlo

study. While generating this particular data set the generated

values of Ui and e-U! were printed. These are listed in Table 4 and

may be compared with the technical efficiency estimates obtained for

the final year of the sample (year 5).

13

Page 16: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

12356789

IOII121315

123456789

12131415

123456789

IoIi12131415

12456789

IO

11111111111112222222222222333333333333333444444444

Table 1 - Data File (egl.d%a)

14.9684016.198609.1856595.6513658.1555986.65237918.079552.78921211.675403.56592413.9946320.617856.02552012.7068623.875566.9659729.3193609.42687117,9151511.2641412.171372.14043527.9031410.717525.0425436.0108643.7027372.3537575.5970539.96229514.3716721,5783325.2539313.876324.7632339.2265179.51795812 5923017 6480314 5666819 9218510 0469538 978249.1700939.43037312.9340517.5053519.637226.76561615.19294

9.4163524.6433345.0947148.7165191.066191

0.25807386.3338162.3502461.0763883.4319484.0325437.975470

0.34381212.4401497.8907382.9060332.6680654.2198162.6613152.4546552.827333

0.43874206.7515914.4247541.583060

0.90721196.148555

0.47938471.9548778.1694944.0546605.0287956.9371408.4050212.5029086.5897377.1486838.0396654.8963816.7217184.1951134.5508467.2232194.8709629.3119442.8948318.0854798.6563453.4267781.918254

35.1336477.2973389.7989527.8782492.1743297.9073982.0839838.8762281.760859.47552355.0960173.1296565.3802563.8392859.2407672.5739268.9160857.4240887.8430130.7894193.7340935.9609880.2746049.8858522.0720938.727055.3223972.52049641.5448068.3891877.5560977.8117398.9043642.7397359.7407918.0855026.6506650.4877488.1821730.4507195.8339536.7036989.3124550.0181840.9963463.0511860.9917694.1594739.3117878.62762

14

Page 17: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Table 1 - Data File (egl.dta) continued

131415

12456789

10121314151112

444555555555555544

21.57045II 5636717 43632I0 6910628 7254717 41430I0 4236515 3524916.91270ii.385607.08096713.2230720.9953417.7588822.2107317.8205211.056391.556997

9.3288907.8338665.6206286 2999232 4697338 1423505 9417509 7949193 6683372 8323591.4983276.2120322.2614936.7278947.7205554.2163696.1771337.188464

87.1238660.3398144.2176830.6762980.4730537.8353856.2179614.9259653.3886767 8879185 8252828 1641299 7169276 7041395 8895141 6880464 376791.073098

Table 2 - Instruction File (egl.ins)

egl.dtaegl.out155682NYN

DATA FILE NAMEOUTPUT FILE NAMENUMBER OF FIRMSNUMBER OF TIME PERIODSTOTAL NUMBER OF OBSERVATIONSNUMBER OF REGRESSOR VARIABLESMU (Y/N)ETA (Y/N)STARTING VALUES (Y/N)IF YES THEN BO

B1 TOBKS I GMA SQUAREDGAMMA

ETA

15

Page 18: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Table 3 - Output File (egl.out)

OUTPUT FROM THE PROGRAM FRONTIER (version 2.0)

THE OLS ESTIMATES ARE :

INTERCEPTX 1X2S I GMA-SQUARED

COEFFICIENT ST~dqDARD-ERROR

-0. I0299895E+000.37353653E+000.51800965E+000.14451374E+00

T-RATIO

0.23648802E+00 -0.43553557E+000.55941207E-01 0.66773056E+010.56523434E-01 0.91645113E+01

LOG LIKELIHCK)D FUNCTION = -0.29184779E+02

THE ESTIMATES AFTER THE GRID SEARCH W3~RE :

0.31720802E+000.37353653E+000.51800965E+000.32630777E+000.85000000E+00

INTERCEPTX 1X2S I GMA- SQUAREDGAMMAMU IS RESTRICTED TO BE ZEROETA 0.50000000E-Of

THE FINAL MLE ESTIMATES ARE :

COEFFICIENT STANDAB!3-E~RROR

0.16321176E+000.38708264E-010.36430275E-010.71495156E-010.72916930E-01

INTERCEPTX 1X2S I GMA-SQUAREDGAMMA

0.32758622E+000.34074197E+000.53242275E+000.19081528E+000.77760260E+00

MU IS RESTRICTED TO BE ZEROETA 0. I1394257E+00 0.44512095E-01

LOG LIKELIHOOD FUNCTION = -0.82557004E+01

VALUE OF CHI-SQUARE TEST OF ONE-SIDED EP~ROR =WITH DEGREES OF FREEDOM = 2

NUMBER OF ITERATIONS = 35

(MAXIMUM NUMBER OF ITERATIONS SET AT : I00)

NUMBER OF FIRMS = 15

NUMBER OF PERIODS = 5

TOTAL NUMBER OF OBSERVATIONS = 68

THUS THERE ARE: 7 OBSNS NOT IN THE PANEL

T-RATIO

0.20071238E+010.88028225E+010.14614843E+020.26689259E+010. I0664226E+02

0.25598115E+01

0.41858158E+02

16

Page 19: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Table 3 - Output Flle (eEl.out) continued

COVARIANCE MATRIX :

0.26638080E-010.35773371E-02

-0.17313582E-020.51860871E-03

-0.47332317E-020.23217409E-030.41787345E-020.45745094E-020.35773371E-020.53168786E-02

-0. I0175208E-02-0.13494765E-02

-0.17313582E-02-0. I0175208E-02

0.14983297E-02-0.61110319E-03-0.I0848577E-04

0.14696762E-040.34952280E-03

-0. I0889522E-020.51860871E-03

-0.13494765E-02-0.61110319E-030.19813266E-02

-0.47332317E-02

-0.I0848577E-04

0.13271650E-02

0.87685684E-04

0.23217409E-03

0.14696762E-04

0.41787345E-02

0.34952280E-03

0.87685684E-04

0.51115574E-02

0,45745094E-02

-0. I0889522E-02

TECHNICAL EFFICIENCY ESTIMATES FOR YEAR

FIRM-NO. TECH.-EFF.-EST.

234 NO56789

I0II121314 NO15

0.64171075E+000.93719961E+000.35867279E+00

OBSERVATION IN THIS PERIOD0 40155731E+000 74762573E+000 77161616E+000 57133789E+000 25591661E+000 77678745E÷000 49469205E+000 71318020E+000 62810524E+00

OBSERVATION IN THIS PERIOD0.75193711E+00

MEAN TECHNICAL EFF.= 0.65362018E+00

17

Page 20: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Table 3 - Output File (egl.out) continued

TECHNICAL EFFICIENCY ESTIMATES FOR YEAR

F IRM-NO. TECH.-EFF.-EST.

123456789

IO1112131415

NONO

000000000

67271438E+0094363894E+0040022609E+0049190378E+0044275528E+0077097449E+0079302683E+0060648055E+0029619948E+00

OBSERVATION IN THISOBSERVATION IN THIS

0.73918814E÷000.65997275E+000.62324284E+000.77494257E+00

PERIODPERIOD

MEAN TECHNICAL EFF.= 0.68074659E+00

TECHN I CAL

FIRM-NO.

EFFICIENCY ESTIMATES FOR YEAR

TECH.-EFF.-EST.

1 0.70172607E+002 0.94944828E+003 0.44142449E+004 0.53060858E+005 0.48313044E+006 0.79251547E+007 0.81272372E+008 0.63973667E+009 0.33750914E+00

I0 0.81689490E+00II 0.57011337E+0012 0.76328562E+0013 0.68985400E+0014 0.65536523E+0015 0.79615584E+00

3 :

MEAN TECHNICAL EFF.= 0.70656806E+00

Page 21: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Table 3 - Output Flle (egl.out) continued

TECHNICAL EFFICIENCY ESTIMATES FOR YEAR 4 :

FIRM-NO. TECH.-EFF.-EST.

123456789

IO1112131415.

0.72873798E+000.95468323E+00

NO OBSERVATION IN THIS PERIOD0.56778587E+000.52230613E+000.81231923E+000.83078618E+000.67101232E+000.37924706E+000.83452688E+000.60533093E+000.78552479E+000.71772647E+000.68551600E+000.81564927E+00

MEAN TECHNICAL EFF.= 0.73100413E+00

TECHNICAL EFFICIENCY ESTIMATES FOR YEAR

FIRM-NO. TECH.-EFF.-EST.

I23456789

I0II12131415

0.75377508E+000.95939573E+00

NO OBSERVATION IN THIS PERIOD0.60321806E+000.55997999E+000.83046877E+000.84730235E+000.70026197E+000.42086124E+000.85065441E+00

NO OBSERVATION IN THIS PERIOD0.80597622E+000.74360346E+000.71366562E+000.83350701E+00

S :

MEAN TECHNICAL EFF.= 0.75400412E+00

19

Page 22: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Table 3 - Output File (egl.out) continued

SUMMARY OF PANEL OF OBSERVATIONS:(1=OBSERVED, O=UNOBSERVED)

T: 1 2 3 4 5N

1 1 I 1 1 12 1 I 1 1 13 1 1 1 0 04 0 1 1 1 15 1 1 1 1 16 1 1 1 1 17 1 1 1 1 18 1 1 1 1 19 1 1 1 1 1

I0 1 0 1 1 1II 1 0 1 1 012 1 1 1 1 113 1 1 1 1 114 0 1 1 1 115 1 1 1 1 1

553455555435545

13 13 iS 14 13 68

Table 4 - Generated Values of Ui and TEl= e-Ui

:_PRINT N UN

1.0000002.0000003.0000004.0000005.0000006.0000007.0000008.0000009.000000I0.00000II.0000012.0000013.0000014.0000015.00000

TEu

0.34984070.8741417E-010.77381800.72212810.58701250.32959630.30062750.48443810.98883910.26904960.64028440.40777900.47669070.49836120.4865283

TE0.70480040.91629750.46124870 48571750 55598580 71921400 74035350 61604330 37200830 76410530 52714250 66512590 62083450 60752540 6147570

2O

Page 23: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

SOME FINAL POINTS

The original verslon of this program was written in 1985, see

Coelll (1985). It was updated in 1986 to include the calculation of

individual firm technlcal efflclencles, see Battese and Coelli

(1988). The analysis of an unbalanced data panel required that the

program be further altered in 1988, see Battese, Coelll and Colby

(1989). This third revision provided the first version of FRONTIER

to be used outside the University of New England. A number of copies

of FRONTIER and the associated documentation (Coelll (1989)) were

provided to interested researchers. Through thls exposure a number

of small bugs were found and reported back to the author. Many

suggestions for improvement and extenslon of FRONTIER were also

provided. As the program required revlsion to permlt the

speclficatlon of time-varying technical efflclency for Battese and

Coelli (1991), we have addressed many of the suggestions of users

and made significant changes to the program, the result being

FRONTIER Version 2.0.

This version has been extensively tested using a number of monte

carlo simulations but undoubtedly a few bugs remain. If users

discover a bug, then it would be appreciated if they contact the

author either by post or on computer mail:

[email protected]

Any users who have not been supplied a copy of the program directly

by the author and who wish to be notified of any-bugs or new

versions, are advised to contact the author so that they may be put

on the mailing llst.

21

Page 24: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Aigner, D.J., C.A.K. Lovell and P. Schmidt (1977), "Formulation and

Estimation of Stochastic Frontier Production Function Models",

Journal of Econometrics, 6, 21-37.

Battese, G.E. (1991), Frontier Production Functions and Technical

Efficiency: A Survey of Empirical Applications in Agricultural

Economics, Working Papers in Econometrics and Applied Statistics,

No. 50, Department of Econometrics, University of New England,

Armidale, pp.32.

Battese, G.E. and T.J. Coelli (1988), "Prediction of Firm-Level

Technical Efficiencies With a Generalized Frontier Production

Function and Panel Data", Journal of Econometrics, 38, 387-399.

Battese, G.E. and T.J. Coelli (1991), Frontier Production Functions,

Technical Efficiency and Panel Data: With Application to Paddy

Farmers in India, Working Papers in Econometrics and Applied

Statistics, No. 56~ Department of Econometrics, University of New

England, Armidale.

Battese, G.E., T.J. Coelli and T.C. Colby (1989), "Estimation of

Frontier Production Functions and the Efficiencies of Indian Farms

Using Panel Data From ICRISAT’s Village Level Studies", Journal of

Quantitative Economics, 5, 327-348.

Battese, G.E. and G.S. Corra (1977),"Estlmation of a Production

Frontier Model: With Application to the Pastoral Zone of Eastern

Australia", Australian Journal of Agricultural Economics, 21, 169-

179.

Bauer, P.W. (1990), "Recent Developments in the Econometric

Estimation of Frontiers", Journal of Econometrics, 46, 39-56.

22

Page 25: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Beck, M. {1991), Empirical Applications of Frontier Functions: A

Bibliography, mlmeo, Joachlm-Ringelnatz-STR.20, W’6200 Wiesbaden,

Germany) pp.9.

Berndt, E.K., B.H. Hall, R.E. Hail and J.A. Housman (1974),

"Estimation and Inference in Non-Linear Structural Models", Annals

of Economic and Social Measurement, 3, 653-665.

Coelli, T.J. (1985)~ A generalised Frontier Production Function for

Cross-Sectional, Time-Series Data) Unpublished B.App. Ec. {Honours)

Dissertation, University of New England, Armldale) NSW, Australia.

Coelli, T.J. {1989), Estimation of Frontier Production Functions:

Guide to the Computer Program, FRONTIER, Working Papers in

Econometrics and Applied Statistics) No.34, Department of

Econometrics, University of New England, Armldale, pp.31.

A

Forsund, F.R., C.A.K. Lovell and P. Schmldt (1980), "A Survey of

Frontier Production Functions and of their Relationship to

Efficiency Measurement", Journal of Econometrics, 13, 5-25.

Himmelblau, D.M. (1972)) Applied Non-Linear Programming, McGraw-

Hill, New York.

Hughes, M.D. (1988), "A Stochastic Frontier Cost Function for

Residential Child Care Provision", Journal of Applied Econometrics,

3, 203-214.

Meeusen, W. and J. van den Broeck (1977), "Efficiency Estimation

from Cobb-Douglas Production Functions With Composed Error",

International Economic Review, 18, 435-444.

Ley, E. (1990), A Bibliography on Production and Efficiency, mimeo,

Department of Economics, University of Ann Arbor, MI 48109, pp.32.

23

Page 26: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Pitt, M.M. and L.-F. Lee (1981), "Measurement and Sources of

Technical Inefficiency in the Indonesian Weaving Industry", Journal

of Development Economics, 9, 43-64,

Schmidt, P. (1986), "Frontier Production Functions", Econometric

Reviews, 4, 289-328.

Stevenson, R.E. (1980), "Likelihood Functions for Generalized

Stochastic FrontletEstimation", Journal of Econometrics, 13, 57-66.

24

Page 27: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

#~PPENDIX A - PROGBAI~’S GUIDE

A. 1 The FRONT2.000 file

The start-up flle, FRONT2.000, is listed in Table AI. Eleven valuesmay be altered in F!RONT2.000. A brief descrlptlon of each follows.

I) IPRINT - If this is set to I, then the program prints out thelog-llkellhood function value and the vector of parameter estimatesat each iteration. The printing of information at each iteration issuppressed if IPRINT is set to O.

2) INDIC - This relates to the Coggln unl-dimenslonal search whichis conducted before each iteration to determine the optimal steplength. It may be used as follows:

indic=2 : do not scale step ler~th in uni-dimenslonal search;indlc=l : scale (to length of last step) only if last step

was smaller; andindic=any other number : scale (to length of last step).

For more information see Himmelblau [1972).

3) TOL - This variable sets the convergence tolerance on theiterative process. If this value is say set to 0.00001 then theiterative proceduqe terminates when the proportional change in thelog-likelihood function and in each of the estimated parameters areall less than 0.00001.

4) TOL2 - This variable sets the required tolerance on the Cogginuni-dimensional search done each iteration to determine the step-length. For more information see Himmelblau (1972).

Table A1 -The start-up file FRONT2.000

KEY VALUES USED IN FRONTIER PROGRAM (VERSION 2.0)NUMBER:11O. 00001O. 001I. OD+I5O. 000110. I1.00I00

DESCRIPTION:IPRINT - 1=PRINT ITERATIONS, O=DO NOTINDIC - USED IN UNIDIMENSIONAL SEARCH - SEE BELOWTOL - CONVERGENCE TOLERANCE (PROPORTIONAL)TOL2 - TOLERANCE USED IN UNI-DIMENSIONAL SEARCHBIGNUM - USED TO SET BOUNDS ON DEN & DISTSTEP1 - SIZE OE IST STEP IN SEARCH PROCEDUREIGRID2 - 1=DOUBLE ACCURACY GRID SEARCH, O=SINGLEGRIDNO - STEPS TAKEN IN IST PHASE GRID SEARCH ON GAMMAGWIDTH - WIDTH EACH SIDE OF 0 OF GRID SEARCH ON ETAIBHHH - I=BERNT HALL H~L & HOUSMAN S.E. ESTIMATES USEDMAXIT - MAXIMUM NUMBER OF ITEBATIONS PERMITTED

THE NI~ERS IN THIS FILE ARE READ BY THE FRONTIER PROGRAM WHEN ITBEGINS EXECUTION. YOU MAY CHANGE THENUMBERS IN THIS FILE IF YOUWISH. IT IS ADVISED THAT A BACKUP OF THIS FILE IS MADE PRIOR TOALTERATION.

25

Page 28: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

5) BIGNUM - This variable is used to specicy largest (and implicitlythe smallest) number that the program should deal with. Its primaryuse is to place bounds upon what the smallest number can be in thesubroutines DEN and DIS which evaluate the standard normal densityand distribution functions, respectively. Errors with numericalunderflows and overflows were the problems most frequentlyencountered by people attempting to install the first version ofthis program on various mainframe computers. This number has beenset to l.Oe+15 for the IBM PC through trial and error. If you planto mount this program on a mainframe computer it is advised that youconsult computer support staff on the correct setting of thisnumber. It generally would be safe to leave it as it is. However,greater precision can be gained if larger numbers are permitted.

6) STEP1 - This variable is used to set the size of the first stepin the iteratlve process. This should be set carefully as too largea value may result in the program ’stepping’ right out of theparameter space.

7) IGRID2 - This is a flag which if set to I will cause the gridsearch to complete a second phase grid search around the estimatesobtained in the first phase of the grid search. If set to O, onlythe first phase of the grid search will be conducted. For moreinformation refer to the description of the grid search in Section

3.

8) GRIDNO - This variable sets the width of the steps taken in thegrid search between zero and one on ~. It will also indirectlyinfluence the degree of precision in the grid search onH and W. Formore information refer to the description of the grid search inSection 3.

9) GWIDTH - This variable sets the width of the grid search onaround zero. That is, a value of 1.0 implies a search will be donefrom -I.0 to +I.0. The value of GWIDTH interacts with GRIDNO todetermine how wide each step is in the grid search on n. Again,refer to the description of the grid search in Section 3 for moreinformation.

I0) IBHHH - This is a flag which allows the user to ask the that thecovariance matrix estimator, proposed by Berndt, et al. (1974), beused instead of using the direction matrix from the last iterationof the Davidon-Fletcher-Powell algorithm to approximate thecovariance matrix. In a few instances, the grid search may providestarting values so close to the minimum that only a small number ofiterations are completed before convergence is achieved. This maymean that the direction matrix may not be a good estimator of thecovarlance matrix. Hence, the Berndt, et al. (1974) matrix may bepreferred. If IBHHH is set to I, this matrix will be used tocalulate standard errors and t-ratios, while if set to O, the finaldirection matrix will be used.

II) MAXIT - sets the maximum number of iterations that will beconducted. This is a handy option when large batch files are writtenfor monte carlo simulation.

26

Page 29: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

A.2 Subroutine Descriptions

The main subroutines in FRONTIER are organlsed as follows:

EXEC --- DATTA--- MINI --- GRID

--- SEARCH--- ETA--- CONVG

--- RESULT

with other subroutines:

FUNDERCHECKOLSINVERT

and functions:

DENDISZIEPEEPR

A brief description of the purpose of each is now presented.

EXEC:This is the main calling program. It firstly reads the start-upfile, FRONT2.000, before calling DATTA to read in data, then MINI tofind the maximum likelihood point, and lastly it calls RESULT tocreate the output.

SUBROUTINES

DATTA:This subroutine reads instructions either from a file or from theterminal, then reads the data file and takes logarithms of the data.

MINI:This is the main subroutine of the program. It firstly calls GRID todo the grid search (assuming starting values are not specified bythe user). MINI then conducts the main iterative loop of FRONTIER,calling SEARCH, ETA and CONVRG repeatedly until the convergencecriteria are satisfied (or the maximum number of iterations isachieved). The Davidon-Fletcher-Powell method is used.

RESULT:Sends all final results to the output file. These include parameterestimates, approximate standard errors, t-ratios, and the individualand mean technical efficiency estimates.

27

Page 30: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

GRID:Does a grid search over ~, ~ and ~ (if no restrictions imposed). Theparameters 8o and ~s2 are adjusted according to expectation theory.

SEARCH:Performs a uni-dimensional search to determine the optima! steplength of the next iteration. The Coggin method is used.

ETA:This subroutine updates the direction matrix according to theDavidon-Fletcher-Powell method at each iteration. For moreinformation, see Himmelblau (1972).

CONVRG:Tests the convergence criterion at the end of each iteration. If theproportion change in the log-likellhood function and each of theparameters is no greater than the value of TOL (initially set to0.00001) the iterative process will terminate.

Calculates the negative of th~ log-likellhood function (LLF). Notethat FRONTIER minimizes the negative of the LLF which is equivalentto maximizing the LLF.

Calculates the first partial derivatives of the negative of the LLF.This subroutine is also used to assist with the calculation of theBerndt, et al. (1974) covariance matrix.

CHECK:Ensures that the estimated parameters do not venture outside the

theoretical bounds (i.e. 0<~<I and ~s2>O).

OLS:Calculates the Ordinary Least-Squares estimates of the model to beused as starting values. It also calculates OLS standard errorswhich are presented in the final output.

INVERT:Inverts a given matrix. It is called by OLS as well as by GRID to

assist with the adjustment of ~s2 in the grid search.

FUNCTIONS

DEN:Evaluates the density function of a standard normal distribution.

DIS:Evaluates the distribution function of a standard normaldistibution.

ZI:Calculates the value of Zi~ as defined in Battese and Coelli (1991).

28

Page 31: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

EPE:Calculates the product of the vector, WI, and its transpose, asdefined in Battese and Coelli (1991). EPE stands for ’Eta PrimeEta’.

EPR:Calculates the product of the vector, ~I, and the transpose of theresidual vector of the i-th firm. EPR stands for ’Eta PrimeResidual’.

29

Page 32: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

APPENDIX B - PROGRAM LISTING

CCCCCCCCCCCCCCCCCCCCC

PROGRAM EXECThis program uses the Davldon-Fletcher-Powell algorithm toestimate using (unbalanced) panel data a frontier productionfunction which has a technical efficiency distribution with anon-zero mode mu and a parameter eta to allow time-varying technicalefficiency (a model formulated by Battese and Coelli (1991)).A large proportion of the SEARCH, CONVRG,MINI and ETAsubroutines are taken from Himmelblau (1972, appendix b).The functions DIS and DENS are based upon subroutines inCorra (1976,appendix B).The remainder of the program is the work of Tim Coelli.Any person is welcome to copy and use this program free ofcharge. The author takes no responsibility for anyinconvenience caused by undetected errors. If an error isdetected the author would appreciate being informed.A 1991 paper in the working paper series in the Department ofEconometrics, University of New England, Armidale, NSW 2351,Australia describes the use of this program.This version of FRONTIER is slightly different to earlier copiesdistributed for mainframes. It has been altered to run onan IBM PC/AT (and compatibles) with 640K using Lahey Fortran 77.Last update = 27/May/1991IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER(KI=IOO,K2=20,K3=I6,K4=K3+4)COMMON/THREE/N,NFUNCT,NDRV, ITER, INDIC, IPRINT, IGRID,MAXIT

COMMON/FR/M(KI),XX(KI,K2,K3),YY(KI,K2),NN,NT,NP,NOMU,NOETA,NBCOMMON/FIVE/TOL,TOL2,BIGNUM,STEPI,IGRID2,GRIDNO,GWIDTH, IBHHHCHARACTER KOUTF’I2OPEN(UNIT=70,FILE=’front2.000’)READ(70,’)READ(70 1)READ(70 ") IPRINTREAD(70 ") INDICREAD(70 ") TOLREAD(70 ") TOL2READ(70 ") BIGNUMREAD(70 ") STEP1READ(70 ") IGRID2READ(70 ") GRIDNOREAD(70 ") GWIDTHREAD(70 ") IBHHHREAD(70 1) MAXITCLOSE(70)NFUNCT=ONDRV=OKOUTF=’CALL DATTA(KOUTF)CALL MINICALL RESULT(KOUTF)STOPEND

30

Page 33: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

SUBROUTINE MINIContains the main loop of this iterative program.IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER(KI=IOO,K2=20,K3=I6,K4=K3+4)COMMON/ONE/X(K4),Y(K4),S(K4),FX,FYCOMMON/TWO/H(K4,K4),DELX(K4),DELG(K4),GX(K4)COMMON/THREE/N,NFUNCT,NDRV, ITER, INDIC, IPRINT, IGRID,MAXIT

COMMON/FR/M(KI),XX(KI,K2,K3),YY(KI,K2),NN,NT,NP,NOMU,NOETA,NBCOMMON/SEVEN/OB(K4),GB(K4),SV(K4),OBSE(K4)DIMENSION GY(K4)DO 98 I=I,K4GX(1)=O.OGY(1)=O.O

98 CONTINUEIF (IGRID.EQ.I) THENWRITE(6,’) ’CALCULATING OLS ESTIMATES...’WRITE(6,’) ’DOING GRID SEARCH...’CALL GRIDELSEDO 131 I=I,NSV(1)=Y(1)X(1)=Y(I)

131 CONTINUECALL FUN(X,FX)FY=FXEND IFWRITE(6,’) ’START OF ITERATIVE PROCESS’ITER=OCALL DER(O,X,GX)WRITE(6,301) ITER,NFUNCT,-FYNC=I

305 WRITE(6,302) (Y(I),I=NC,MIN(N,NC+4))NC=NC+5IF(NC.LE.N) GOTO 305IF (MAXlT.EQ.O) GOTO 70

5 DO 20 I=I,NDO I0 J=I,N

10 H(I,J)=O.O20 H(I,I)=I.O

IF(IPRINT.EQ.I) WRITE(6,2100)2100 FORMAT(’ GRADIENT STEP’)

DO 30 I=I,N30 S(1)=-GX(I)40 CALL SEARCH

ITER=ITER+IIF (ITER.GE.MAXIT) THENWRITE(6,*) ’MAXIMUM NUMBER OF ITERATIONS REACHED’GOTO 70ENDIF

7 IF(FY.GT.FX) GOTO 5CALL DER(O,Y,GY)CALL CONVRG(IPASS)IF (IPASS.EQ.I.) GOTO 70

31

Page 34: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

IF(IPRINT.EQ.I) THENWRITE(6,301) ITER,NFUNCT,-FYNC=I

304 WRITE(6,302) (Y(1),I=NC,MIN(N,NC+4))NC=NC+5IF(NC.LE.N) GOTO 304ENDIFDO 50 I=I,NDELG(1)=GY(1)-GX(1)DELX(1)=Y(1)-X(1)GX(I)=GY(I)

50 X(1)=Y(I)FX=FYCALL ETADO 60 I=I,NS(I)=O.ODO 60 J=I,N

60 S(1)=S(1)-H(I,J)’GY(J)GOTO 4O

70 CONTINUEWRITE(6,3OI)’ITER,NFUNCT,-FYNC=I

303 WRITE(6,302) (Y(1),I=NC,MIN(N,NC+4))NC=NC+5IF(NC.LE.N) GOTO 303

301 FORMAT(’ ITERATION = ’,15,’ FUNC EVALS302 FORMAT(4X,SEIS.8)

END

LLF =’,E16.8)

CCCC

102O

3040

SUBROUTINE CONVRG(IPASS)Tests the convergence criterion.The program is halted when the proportional change in the log-likelihood and in each of the parameters is no greater thana specified tolerance.IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER(KI=IOO,K2=20,K3=I6,K4=K3+4)COMMON/ONE/X(K4),Y(K4),S(K4),FX,FYCOMMON/THREE/N,NFUNCT,NDRV, ITER, INDIC, IPRINT, IGRID,MAXITCOMMON/FIVE/TOL,TOL2,BIGNUM,STEPI,IGRID2,GRIDNO,GWIDTH, IBHHHXTOL=TOLFTOL=TOLIF(DABS(FX).LE.FTOL) GOTO 10IF(DABS((FX-FY)/FX).GT.FTOL) GOTO 60GOTO 20IF(DABS(FX-FY).GT.FTOL) GOTO 60DO 40 I=I,NIF(DABS(X(1)).LE.XTOL) GOTO 30IF(DABS((X(1)-Y(1))/X(1)).GT.XTOL) GOTO 60GOTO 40

IF(DABS(X(1)-Y(1)).GT.XTOL) GOTO 60CONTINUE

IPASS=I

32

Page 35: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

60

C

IPASS=2RETURNEND

30

117

132

133

134

SUBROUTINE ETACalculates the direction matrix (P).IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER(KI=IOO,K2=20,K3=I6,K4=K3+4)COMMON/TWO/H(K4,K4),DELX(K4),DELG(K4),GX(K4)COMMON/THREE/N,NFUNCT,NDRV, ITER, INDIC, IPRINT, IGRID,MAXITCOMMON/FIVE/TOL,TOL2,BIGNL~,STEPI,IGRID2,GRIDNO,GWIDTH, IBHHHDIMENSION HDG(K4),DGH(K4),HGX(K4)DXDG=O.O

DO 20 I=I,NI-~(1)=O.ODGB(1)=O.ODO 10 J=I,NI-I~(I)=I-IDG(I)-~(I,J)’D~I..G(j)

I0 DGH(I)=DGB(I)+D~LG(J)’B(j,I)DXI)G=DXI)G+D]~L.X(I)~D~LG(I)

~0 DGI-IIX3=DGI-IDG+DG~(I)~D~LG(I)DO 30 I=I,NDO 30 J=I,NR(I,J)=B(I,J)+D~LX(1)’DI~(J)/DXDG+HDG(1)’DGR(J)/DGI-IDGDO 11~ I=I,NH(I,I)=DABS(R(I,I))DO 132 I=I,NBGX(1):O.ODO 132 J=I,NHGX(1):BGX(1)+R(I,J)’GX(J)CONTINU~~GXX=O.GXX:O.DO 133 I=I,NHGXX=RGXX+RGX(I)’’2GXX:=GXX+GX(1)’’2CONTINU~C:O.DO 13~ I=I,NC:C+RGX(1)’GX(1)CONTINU~C:C/(~GXX’GXX)’’O.5IF(DABS(C).LT.O.O0001) TI-IZNWRITZ(6,~) ’ILL-CONDITIONZD ZTA’DO 136 I=I,NDO 13~ 3=1,N

137 ~(l,J):O.O136 ~(I,I)=DZLX(I)/GX(1)

ZNDI~

~ND

SUBROUTINE SEARCH

33

Page 36: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

CC

UNIDIMENSIONAL SEARCH (COGGIN)Determines the step length (t) using a unidimensional search.IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARA~TER (KI=IO0, K2=20, K3=16, K4=K3+4 )COMMON/ONE/X (K4), Y (K4), S (K4), FX, FYCOMMON/TWO/H (K4, K4 ), DELX (K4), DELG (K4), GX (K4)COMMON/THREE/N, NFUNCT, NDRV, ITER, INDIC, IPRINT, IGRID, MAXITCOMMON/F I VE/TOL, TOL2, B I GNUM, STEP 1, I GRI D2, GR I DNO, GW I DTH, I BHHHIEXIT=ONTOL=OFTOL=TOL2FTOLZ=FTOL/100.0FA=FXFB=FXFC=FXDA=O. 0DB=O. 0DC=O. 0K=-2M=OSTEP=STEP1D=STEPIF(INDIC.EQ.2.0R. ITER.EQ.O) GOTO 1DXNORM=O. 0SNORM=O. 0DO 202 I=I,NDXNORM=DXNORM+DELX ( I ) "DELX ( I )

102 SNORM=SNORM+S ( I ) "S ( I )IF( INDIC. EQ. I. AND. DXNORM. GE. SNORM)RAT I O=DXNORM/SNORMSTEP=DSQRT (RATIO)D=STEP

1 DO 2 I=I,N2 Y(I)=X(I)+D’S(I)

CALL FUN (Y, F)K=K+ IIF (F-FA) 5,3,6

3 DO 4 I=I,N4 Y(1)=X(1)+DA’S(1)

FY=FAIF(IPRINT.EQ.I) WRITE(6,2100)

2100 FORMAT(’ SEARCH FAIleD.GOTO 326

5 FC=FBFB=FAFA=FDC=DBDB=DADA=DD=2. O~D+STEPGOTO 1

6 IF(K) 7,8,97 FB=F

DB=D

GOTO I

FN VAL INDEP OF SEARCH DIRECTION’)

34

Page 37: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

n=-n

STEP=-STEPGOTO 1

8 FC=FBFB=FAFA=FDC=DBDB=DADA=DGOTO 21

9 DC=DBDB=DADA=D

FB=FAFA=F

10D=O.S’(DA+DB)DO II I=I,N

11 Y(I)=X(I)+D*S(I)CALL FUN(Y,F)

121314

IF((DC-D)’(D-DB)) 15,13,18DO 14 I=I,NY(I)=X(I)+DB’B(I)FY=FBIF(IEXIT.EQ.I) GOTO 32IF(IPRINT.EQ.I) WRITE(6,2500)

2500 FORMAT(’ SEARCH FAILED. LOC OF MIN LIMITED BY ROUNDING’)GOTO 325

15 IF(F-FB) 16,13,1716 FC=FB

FB=FDC=DBDB=DGOTO 21

17 FA=FDA=DGOTO 21

18 IF(F-FB) 19,13,2019 FA=FB

FB=FDA=DBDB=DGOTO 21

20 FC=FDC=D

21A=FA’(DB-DC)+FB*(DC-DA)+FC’(DA-DB)IF(A) 22,30,22

22 D=O.5"((DB*DB-DC’DC)’FA+(DC’DC-DA"DA)’FB+(DA*DA-DB~DB)’FC)/AIF((DA-D)’(D-DC)) 13,13,23

23 DO 24 I=I,N24 Y(1)=X(I)+D’S(1)

CALL FUN(Y,F)IF(DABS(FB)-FTOL2) 25,25,26

25 A=I.O

35

Page 38: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

GOTO 2726 A=I.0/FB27 IF((DABS(FB-F)’A)-FTOL) 28,28, 1228 IEXIT=I

IF(F-FB) 29,13, 1329 FY=F

GOTO 3230 IF(M) 3!,31,1331 M=M+I

GOTO 1032 DO 99 I=I,N

IF(Y(1).NE.X(I)) GOTO 32599 CONTINUE

GOTO 33325 IF(NTOL.NE.O.AND. IPRINT.EQ.1) tCRITE(6,3000)

3000 FORMAT(1X,’TOLERANCE REDUCED’,II,’TIME(S)’)326 IF (FY. LT. FX) RETURN

DO I01 I=I,NIF(S(I) .NE.-GX(I) ) RETURN

I01 CONTINUEWRITE (6,5000)

5000 FORMAT(’ SEARCH FAILED ONRETURN

33 IF(NTOL.EQ.5) GOTO 34IEXIT=ONTOL=NTOL+ 1FTOL=FTOL/10.GOTO 12

34 IF(IPRINT. EQ. I) WRITE (6,2000)2000 FORMAT (’

RETURNEND

GRADIENT STEP,

NTOL

TERMINATION’)

PT BETTER THAN ENTERING PT CANNOT BE FOUND’)

CSUBROUTINE CHECKChecks if params are out of bounds & adjusts if required.IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER (KI=IO0, K2=20, K3=16, K4=K3+4 )COMMON/ONE/X (K4), Y (K4), S (K4), FX, FYCOMMON/THREE/N, NFUNCT, NDRV, ITER, INDIC, IPRINT, IGRID, MAXIT

COMMON/FR/M (KI), XX (KI, K2, K3 ), YY (KI, K2 ), NN, NT, NP, NOMU, NOETA, NBNI=NB+IN2=NB+2IF(X(NI).LE.O O) X(NI)=O.O001IF(X(NZ).LE.O 01) X(N2)=O.OIIF(X(NZ).GE.O 99) X(N2)=0.99IF(Y(NI).LE.O O) Y(NI)=O.O001IF(Y(N2).LE.O 01) Y(N2)=O.OIIF(Y(N2).GE.O 99) Y(N2)=0.99RETURNEND

SUBROUTINE FUN(B,A)Calculates the negative of the log-likelihood function.IMPLICIT DOUBLE PRECISION (A-H,O-Z)

36

Page 39: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

134

133

132

cccccc

PARAMETER(K1=IOO,K2a20,K3=16,K4=K3+4)COMMON/THREE/N,NFUNCT,NDRV, ITER, INDIC, IPRINT, IGRID,MAXIT

COMMON/FRAM(KI),XX(KI,K2,K3),YY(KI,K2),NN,NT,NP,NOMU,NOETA,NBDATA PI/3.1415926/DIMENSION B(K4)CALL CHECKA=O.OF=DFLOAT(NN)FTOT=DFLOAT(NT)NI=NB+IN2=NI+IN3=N2+IA=O.5"FTOT*(DLOG(2.0"PI)+DLOG(B(N1)))A=A+O.S*(FTOT-F)*DLOG(I.O-B(N2))Z=B(N3)/(B(NI)’B(N2))’’0.5A=A+F’DLOG(I.0-DIS(-Z))A=A+O.S’F’Z’*2A2=O.ODO 132 I=I,NNA=A+O.5"DLOG(I.O+(EPE(I,B)-I.O)"B(N2))A=A-DLOG(I.O-DIS(-ZI(I,B)))DO 133 L=I,NP"IF (XX(I,L,I).NE.O.O) THENE=YY(I,L)DO 134 J=I,NBE=E-B(J)’XX(I,L,J)CONTINUEA2=A2+E’’2END IFCONTINUEA=A-O.5"ZI(I,B)’’2CONTINUEA=A+O.5"A2/((I.O-B(N2))’B(NI))NFUNCT=NFUNCT+I

END

SUBROUTINE DER(JJ,B,GX)Calculates the fist-order partial derivatives of the negativeof the log-likellhood function and is also used to calculatethe i-th first-order partial derivative of the joint densityfunction of Y (used in the calculation of the covariance matrixsuggested by Berndt, Hall, Hall and Housman when the IBHHH flag isset to I in the start-up file FRONT2.000)IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER(KI=IOO,K2=20,K3=16,K4=K3+4)COMMON/THREE/N,NFUNCT,NDRV, ITER, INDIC, IPRINT, IGRID,MAXIT

COMMON/FR/M(KI),XX(KI,K2,K3),YY(KI,K2),NN,NT,NP,NOMU,NOETA,NBDIMENSION B(K4),GX(K4)NI=NB+IN2=NB+2N3=NB+3N4=NB+4IF (NOMU.EQ.O) THEN

37

Page 40: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

N4=N3N3=NB+4END IFIF (JJ. EQ. O)THENF=DFLOAT (NN)FTOT=DFLOAT { NT )KK=IMM=NNELSEF=I.FTOT=DFLOAT (M (JJ) )KK--JJ

END IFFNP=DFLOAT ( NP )

Z=B(N3)/(B(N1)’B(N2))’’0.5DO 132 J=I,NBA=O.ODO 133 I=KK,MMDO 134 L=I,NPE=YY(I,L)DO 135 K=I,NBE=E-XX(I,L,K)’B(K)

135 CONTINUEA=A+XX(I,L,J)’E

134 CONTINUE133 CONTINUE

A=-A/(B(N1)’(1.-B(N2)))DO 136 I=KK,MMXPE=O.ODO ~46 L=I,NPIF (XX(I,L,I).NE.O.O) THENXPE=XPE+XX ( I, L, J ) "DEXP ( -B (N4)" (DFLOAT (L) -FNP ) )END IF

146 CONTINUED=(DEN(-ZI(I,B))/(I.O-DIS(-ZI(I,B)))+ZI(I,B))’B(N2)~XPEA=A-D/(B(N2)’(I.O-B(N2))’B(N1)’(I.O+(EPE(I,B)-I.O)’B(N2)))’’0.5

136 CONTINUE ¯GX(J)=A

132 CONTINUE

139

138137

A=O.5"FTOT/B(NI)-O.5"F’(DEN(-Z)/(I.O-DIS(-Z))+Z)"Z/B(NI)SS=O.ODO 137 I=KK,MMA=A+.5"(DEN(-ZI(I,B))/(I.O-DIS(-ZI(I,B)))+ZI(I,B))’ZI(I,B)/B(NI)DO 138 L=I,NPE=YY(I,L)DO 139 J=I,NBE=E-XX(I,L,J)’B(J)CONTINUESS=SS+E’’2CONTINUECONTINUE

38

Page 41: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

A=A-0.5"SS/((1.0-B(N2))tB(N1)’*2)GX(N1)=A

140

A=-O.5"(FTOT-F)/(1.0-B(N2))A=A-O.5"F’(DEN(-Z)/(I.O-DIS(-Z))+Z)’Z/B(N2)A=A+O.5"SS/((I.O-B(N2))’’2"B(NI))DO 140 I=KK,MMA=A+O.5"(EPE(I,B)-I.O)/(I.0+(EPE(I,B)-I.0)’B(N2))D=B(N2)’(1.-B(N2))’(1.0+(EPE(I,B)-I.0)’B(N2))DZI=-(B(N3)+EPR(I,B))’DC=0.5"(B(N3)’(IoO-B(N2))-B(NZ)’EPR(I,B))DZI=DZI-C’((I.O-2.0"B(N2))+(EPE(I,B)-I.O)’B(N2)~(2.0-3.0~B(N2)))DZI=DZI/(D’’I.5"B(NI)I’0.5)A=A-(DEN(-ZI(I,B))/(I.O-DIS(-ZI(I,B)))+ZI(I,B))~DZICONTINUEGX(N2)=A

142

IF CNOMU.EQ.1) THENA=F/(B(NI)’B(N2))"O.5"CDENC-Z)/CI.O-DIS(-Z))+Z)130 142 I=KK,MMD=(.DEN(-ZI(I,B))/(I.O-DIS(-ZI(I,B)))+ZI(I,B))~(I.-B(N2))A=A-D/(B(N2)’(1.-B(N2))"B(NI)’(1.+(EPE(I,B)-I.)’B(N2)))~.5CONTINUEGX(N3)=AEND IF

IF (NOETA.EQ.I) THENA=O.ODO 1511=KK,MMDE=O.OD=O.ODO 152 L=I,NPIF (XX(I,L,I).EQ.1) THENT=DFLOAT(L)DE=DE-2.0"(T-I.0)’DEXP(-2.0"B(N4)’(T-FNP))E=YY(I,L)DO 153 J=I,NBE=E-XX(I,L,J)’B(j)

153 CONTINUED=D+(T-I.O)’DEXP(-B(N4)’(T-FNP))iEEND IF

152 CONTINUEDD=(B(N2)’(1.0-B(N2))’B(NI)’(1.0+(EPE(I,B)-I.0)’B(N2)))D=D’B(N2)’DDC=B(N3)’(1.0-B(N2))-B(N2)’EPR(I,B)C=C’0.SIB(N2)’’21(I.0-B(N2))IB(N1)IDEDZI=(D-C)/DD’’I.5A=A-(DEN(-ZI(I,B))/(I.O-DIS(-ZI(I,B)))+ZI(I,B))’DZIA=A+B(N2)/2.0~DE/(I.O+(EPE(I,B)-I.O)’B(N2))

151 CONTINUEGX(N4)=AEND IF

NDRV=NDRV+I

39

Page 42: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

C

C

DOUBLE PRECISION FUNCTION DEN(A)Evaluates the N(O,I) density function.IMPLICIT DOUBLE PRECISION (A-H,O-Z)COMMON/F IVE/TOL, TOL2, BIGNUM, STEP1, IGRID2, GRIDNO, GWIDTH, IBHHHDATA RRT2PI/ 0.3989422804/DEN=RRT2P I’DEXP (-0.5"A’" 2 )IF (DEN. LT. 1. O/BIGNUM) DEN=I. O/BIGNUM

END

DOUBLE PRECISION FUNCTION DIS(X)Evaluates the N(O,I) distribution function.IMPLICIT DOUBLE PRECISION (A-H,O-Z)COMMON/FIVF/TOL,TOL2,BIGNUM,STEPI,IGRID2,GRIDNO,GWIDTH, IBHHHDIMENSION A(5),CONNOR(17)DATA CONNOR+ /8.0327350124D-17, 1.4483264644D-15, 2.4668270103D-14,+ 3.9554295164D-13, 5.9477940136D-12, 8.3507027951D-II,+ 1.0892221037D-9, 1.3122532964D-8, 1.4503852223D-7,+ 1.4589169001D-6, 1.3227513228D-5, 1.0683760684D-4,+ 7.5757575758D-4, 4.6296296296D-3, 2.3809523810D-2,+ 0. I, 0.3333333333 /DATA RRT2PI/0.3989422804/S=XY=S’SIF(S) 10,11,12

11 P=0.5GOTO 31

I0 S=-S12 Z=RRT2PI’DEXP(-O.5"Y)

IF(S-2.5) 13,14,1413 Y=-O.5"Y

P=CONNOR(1)DO 15 L=2,17

15 P=P’Y+CONNOR(L)P=(P’Y+I.O)’X’RRT2PI+0.5GOTO 31

14 A(2)=I.OA(5)=I.OA(3)=I.OY=I.O/YA(4)=I.O+YR=2.0

19 DO 17 L=I,3,2DO 18 J=l,2K=L+JKA=7-K

18 A(K)=A(KA)+A(K)’R’Y17 R=R+I.O

IF(DABS(A(2)/A(3)-A(5)/~(4)).GT.I.OD-15) GOTO 1920 P=(A(5)/A(4))’Z/X

4O

Page 43: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

21

2231

IF(X) 21,11,22p=-p

GOTO 31P=I. O-PCONTINUE

IF(P. LT. I. O/BIGNUM) P=I. O/BIGNUMIF(P. GT. ( I. 0-I. O/BIGNUM) ) P=I. 0-I. O/BIGNUMDIS=P

END

CDOUBLE PRECISION FUNCTION ZI(I,B)Calculates the value of zi" as defined in Battese and Coelli (1991)IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER(KI=IOO,K2=20,K3=I6,K4=K3+4)COMMON/THREE/N, NFUNCT, NDRV, ITER, INDIC, IPRINT, IGRID, MAXIT

COMMON/FR/M (KI), XX (KI, K2, K3 ), YY (KI, K2 ), NN, NT, NP, NOMU, NOETA, NBDIMENSION B(K4)NI=NB+IN2=NB+2N3=NB+3A=B(N3)’(I.O-B(N2))-B(N2)’EPR(I,B)ZI=A/(B(N2)’(I.O-B(N2))’B(NI)’(I.O+(EPE(I,B)-I.O)-B(N2)))~-0.5

END

DOUBLE PRECISION FUNCTION EPE(I,B)Calculates eta prime eta.IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER(KI=IOO,K2=20,K3=I6,K4=K3+4)

COMMON/FR/M(KI),XX(KI,K2,K3),YY(KI,K2),NN,NT,NP,NOMU,NOETA,NBDIMENSION B(K4)IF (NOMU.EQ.I) THENN4=NB+4ELSEN4=NB+3END IF

FNP=DFLOAT(NP)DO I01L=I,NPIF (XX(I,L,I).NE.O.O) TMP=TMP+DEXP(-2.0-B(N4)-(DFLOAT(L)-FNP))

lOl CONTINUEEPE=TMP

END

DOUBLE PRECISION FUNCTION EPR(I,B)Calculates eta prime residual.IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER(KI=IOO,K2=20,K3=I6,K4=K3+4)

COMMON/FR/M(KI),XX(KI,K2,K3),YY(KI,K2),NN,NT,NP,NOMU,NOETA,NBDIMENSION B(K4)IF (NOMU.EQ.I) THENN4=NB+4

41

Page 44: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

ELSEN~=NB+3END IFTMP=O. 0FNP=DFLOAT (NP)DO 101 L=I,NPIF (XX(I,L,I).NE.O.O) THENE=YY(I,L)DO 102 J=I,NBE=E-B (J)’XX(I ,L,J)

102 CONTINUETMP=TMP+E" DEXP ( -B (N4) ¯ ( DFLOAT (L) -FNP ) )END IF

I01 CONTINUEEPR--TMP

END

SUBROUT I NE DATTA (KOUTF)Reads data in from a file (note that it is NOT in log-form).IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER (KI=IO0, K2=20, K3=I 6, K4=K3+4 )COMMON/ONE/X (K4), Y (K4), S (K4), FX, FYCOMMON/THREE/N, NFUNCT, NDRV, ITER, INDIC, IPRINT, IGRID, MAXIT

COMMON/FR/M (KI), XX (KI, K2, K3 ), YY (KI, K2 ), NN, NT, NP, NOMU, NOETA, NBCHARACTER KDATF" 12, K INF" 12, KOUTF" 12, CHOP, CHMU, CHETA, CHSTDIMENSION XXT (K3)NOMU=ONOETA=OCHMU~’ N’CHETA=’ N’IGRID=IDO 131 I=I,K4Y(I)=O.OX(I)=O.OS(I)=O.O

131 CONTINUEWRITE(6,’) ’ FRONTIER - Version 2.0’WRITE(6,’)’DO YOU WISH TO TYPE INSTRUCTIONS AT THE TERMINAL (T)’WRITE(6,’) ’ OR USE AN INSTRUCTION FILE IF) ?’READ(5,61 ) CHOP

61 FORMAT(A)IF ((CHOP.EQ.’T’).OR. (CHOP.EQ.’t’)) THENWRITE(6,’) ’ ENTER THE NAME OF YOUR DATA FILE : ’READ (5,60) KDATFWRITE(6,’) ’ ENTER A NAME FOR AN OUTPUT FILE : ’READ (5,60) KOUTFWRITE(6,’) ’ HOW MANY FIRMS IN THE DATA ? ’READ (5, ") NNIF(NN.GT.KI) THENWRITE(6,70) K1STOPENDIFWRITE(6,’) ’ HOW MANY TIME PERIODS IN THE DATA ? ’

42

Page 45: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

READ(5, ") NPIF(NP. GT. K2) THENWRITE(6,71) K2STOPENDIFWRITE(6,’) ’ HOW MANY OBSERVATIONS ARE THERE IN TOTAL ? ’READ C5, ") NTIF (CNN’NP).LT.NT) THENWRITE(6,’) ’ THE ABOVE NUMBER IS LARGER THAN THE PRODUCT OF THE’WRITE(6,’) ’ PREVIOUS TWO ANSWERS - PROGRAM ABORT!’STOPEND IFWRITE C6," ) ’ HOW MANY REGRESSOR VARIABLES ARE THERE ? ’READ(5, ") NBIF(NB. GE. K3) THENWRITE(6,72) K3STOPENDIFWRITE(6,’) ’ DOES THE MODEL INCLUDE MU ? (Y or N) ’EADCS, ") ~WRITEC6,’) ’ DOES THE MODEL INCLUDE ETA ? CY or N) ’READC5, ") CHETAWRITE(6,’) ’ IF YOU DO NOT WISH THE COMPUTER TO SELECT’WRITE(6,’) ’ STARTING VALUES USING A GRID SEARCH YOU MUST’WRITE { 6, ") ’ SUPPLY THEM NOW’WRITE(6,’) ’ DO YOU WISH TO SUPPLY STARTING VALUES ? (Y or N)’READ(S,’) CHSTIF ( (CHST. EQ. ’ Y’ ). OR. (CHST. EQ. ’ y’ ) ) THENIGRID=0

62 FORMAT(’ ENTER STARTING VALUE FOR B’, 12,’ :DO 138 I=I,NB+IWRITE(6,62) I-IREADC5, ") YCI)

138 CONTINUEWRITE(6,’) ’ ENTER STARTING VALUE FOR SIGMA SQUARED : ’READ (5, ") Y(NB+2)WRITE(6,’) ’ ENTER STARTING VALUE FOR GAMMA :READ (5, ") Y(NB+3)IF ( (CHMU. EQ. ’ Y’ ). OR. (CHMU. EQ. ’ y’ ) ) THENWRITE(6,’) ’ ENTER STARTING VALUE FOR MU : ’READ(5, ") Y(NB+4)IF ( (CHETA. EQ. ’ Y’ ). OR. (CHETA. EQ. ’ y’ ) ) THENWRITE(6,’) ’ ENTER STARTING VALUE FOR ETA : ’READ (5, ") Y(NB+5)END IFELSEIF ((CHETA.EQ.’Y’).OR.(CHETA.EQ.’y’)) THENWRITE(6,’) ’ ENTER STARTING VALUE FOR ETA : ’HEAD(5, ") Y(NB+4)END IFEND IFEND IFELSE IF ((CHOP.EQ.’F’).OR.(CHOP.EQ.’f’)) THENWRITE(6,’) ’ ENTER INSTRUCTION FILE NAME : ’

43

Page 46: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

READ (5,60) KINF60 FORMAT (AI2)

OPEN (UN I T=50, FILE=K INF )READ (S0,60) KDATFREAD (50,60) KOUTFP-,.F_,AD ( 50, " ) NNREAD (50, ") NPREAD (50, ") NTIF ((NN’NP).LT.NT) THENWRITE(6,’) ’ THE TOTAL NUMBER OF OBSNS EXCEEDS THE PRODUCT OF’WRITE(6,’) ’ THE NUMBER OF FIRMS BY THE NUMBER OF YEARS - BYE!’STOPEND IFREAD (50, " ) NBREAD (50,61) CHMUREAD(50,61) CHETAREAD(50,61) CHSTIF ((CHST.EQ.’Y’).OR.(CHST.EQ.’y’)) THENIGRID=ODO 148 I=I,NB+3READ(50, ") Y(I)

148 CONTINUEIF ( (CHMU. EQ. ’ Y’ )o OR. (CHMU. EQ. ’ y’ ) ) THENREAD(50, ") Y(NB+4)IF ((CHETA.EQ.’Y’).OR.(CHETA. EQ.’y’)) READ(50,’) Y(NB+5)ELSEIF ((CHETA.EQ.’Y’).OR. (CHETA. EQ.’y’)) READ(50,*’) Y(NB+4)END IFEND IFELSEWRITE(6,’) ’ INCORRECT OPTION - MUST BE T OR F - BYE!’STOPEND I F

70 FORMAT(’ ERROR- MAXIMUMCROSS-SECTIONS ALLOWED = ’,I4)71 FORMAT(’ ERROR- MAXI~ TIME PERIODS ALLOWED = ’, I4)72 FORMAT(’ ERROR- MAXIMUMREGRESSORS ALLOWED =’, I4)

IF(NN.GT.KI) THENWRITE(6,70) K1STOPELSE IF(NP.GT.K2)WRITE(6,71) K2STOPELSE IF(NB.GE.K3)WRITE(6,72) K3STOPENDIF

THEN

THEN

IF ((CHMU.EQ.’Y’).OR.(CHMU.EQ.’y’)) NOMU=IIF ((CHETA.EQ.’Y’).OR.(CHETA.EQ.’y’)) NOETA=INB=NB+IN=NB+2+NOMU+NOETAOPEN(UNIT=40,FILE=KDATF)MINI=IO0

MINT=20

44

Page 47: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

DO 132 I=I,NNM(1)=ODO 132 L=I,NPYY(I,L)=O. 0DO 132 J=I,NBXX(I,L,J)=O. 0

132 CONTINUEDO 134 I=I,NTREAD(40, ") FII ,FTT,YYT, (XXT(j) ,J=2,NB)I I=INT (FI I )ITT=INT (FTT)IF (II.LT.MINI) MINI=IfIF (II.GT.MAXI) MAXI=IIIF (ITT.LT.MINT) MINT=ITTIF (ITT.GT.MAXT) MAXT=ITTM(II)=M(II)+IIF(YYT. LE. O. O) THENWRITE(6,’) ’ ZERO OR NEGATIVE NUMBER IN DATA - TERMINATION!’STOPENDIFYY( If, ITT) =DLOG (YYT)DO 135 J=2,N5~IF(XXT(J). LE. O. O) THENWRITE(6,’) ’ ZERO OR NEGATIVE NUMBER IN DATA - TERMINATION!’STOPENDIFXX( I I, ITT, J)=DLOG(XXT (j))

135 CONTINUEXX(II, ITT, I)=I.0

134 CONTINUEIF (MINI.LT. I) THENWRITE(6,’) ’ ERROR - A FIRM NUMBER IS < I’STOPELSE IF (MAXl. GT. NN) THENWRITE(6,’) ’ ERROR - A FIRM NUMBER IS > NUMBER OF FIRMS’STOPELSE IF (MINT.LT. I) THENWRITE(6,’) ’ ERROR - A PERIOD NUMBER IS < I’STOPELSE IF (MAXT. GT. NP) THENWRITE(6,’) ’ ERROR - A PERIOD NUMBER IS > NUMBER OF PERIODS’STOPEND IFDO 149 I=I,NNIF (M(I).EQ.O) THENWRITE (6,66) I

66 FORMAT(’ ERROR - THERE ARE NO OBSERVATIONS ON FIRM ’, I3)STOPEND IF

149 CONTINUE

END

45

Page 48: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

CCC

401

402201 FORMAT(’ INTERCEPT ’,E16.8)202 FOPd4AT(’ X’,I2,1OX,EI6.8)203 FOP/MAT(’ SIGMA-SQUAP~D’,EI6.8)204 FORMAT(’ GAMMA ’,E16.8)205 FOR~T(’ MU ’,E16.8)206 FORMAT(’ ETA ’,E16.8)

WRITE (70,201) SV(1)DO 131 I=2,NB -W~ITE (70,202) I-I,SV(1)

131 CONTINUEWRITE (70,203) SV(NI)WRITE (70,204) SV(N2)IF (NOMU.EQ.I) THENWRITE (70,205) SV(N3)ELSEWRITE (70,’) ’ MU IS RESTRICTED TO BE ZERO’END IFIF (NOETA.EQ.I) THENWRITE (70,206) SV(N4)ELSEWRITEEND IFELSEWRITE (70,403)

403 FORMAT(/,’THE OLS ESTIMATES ARE :’,/)

SUBROUTINE RESULT(KOUTF)Presents estimates, covarlance matrix, standard errorswell as presenting many results including estimates ofefficiency.IMPLICIT DOUBLE PRECISION (A-H,O-Z)PAP~TER(KI=IOO,K2=20,K3=I6,K4=K3+4)COMMON/ONE/X(K4),Y(K4),S(K4),FX~FYCOMMON/TWO/H(K4,K4),DELX(K4),DELG(K4),GX(K4)COMMON/THREE/N,NFUNCT,NDRV, ITER, INDIC, IPRINT, IGRID,MAXIT

COMMON/FR/M(KI),XX(KI,K2,K3),YY(KI,K2),NN,NT,NP,NOMU,NOETA,NBCOMMON/FIVE/TOL,TOL2,BIGNUM,STEPI,IGRID2,GRIDNO,GWIDTH, IBHHHCOMMON/SEVEN/OB(K4),GB(K4),SV(K4),OBSE(K4)CHARACTER KOUTF’I2DIMENSION COV(K4,K4),DX(KI,K4),CX(K4),MT(K2)DATA PI/3.1415926/OPEN (UNIT=70,FILE=KOUTF)NI=NB+IN2=NB+2N3=NB+3N4=NB+4IF (NOMU.EQ.O) THENN4=N3N3=NB+4END IFWRITE (70,401)FOR~T(/,’OUTPUT FROM THE PROGRAM FRONTIER (Version 2.0)’,//)IF (IGRID.EQ.O) THENWRITE (70,402)FORMAT(’THE STARTING VALUES SUPPLIED WERE : ’,/)

(70,’) ’ ETA IS RESTRICTED TO BE ZERO’

and t-ratios,technical

as

46

Page 49: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

WRITE (70,4O4)404 FORMAT(’

+

WRITE (70,301)DO 132 I=2,NBWRITE (70,302)

132 CONTINUEWRITE (70,203)FNT=DFLOAT(NT)FNB=DFLOAT(NB)

COEFFICIENT STANDARD-ERROR’,T-RATIO’,/)OB(1),OBSE(1),OB(1)/OBSE(1)

I-I,OB(I),OBSE(I),OB(I)/OBSE(I)

OB(N1)

FXOLS=FNT/2.0"(DLOG(2.0"PI)+DLOG(OB(NI)*(FNT-FNB)/FNT)+I.O)WRITE(70,SOI) ~FXOLSWRITE (70,405)

405 FORMAT(/,’THE ESTIMATES AFTER THE GRID SEARCH WERE :’,/)WRITE (70,201) GB(1)DO 133 I=2,NBWRITE (70,202) I-I,GB(1)

133 CONTINUEWRITE (70,203) GB(NI)WRITE (70,204) GB(N2)IF (NOMU.EQ.I) THENWRITE (70,205) GB(N3)ELSEWRITE (70,’) ’ MU IS RESTRICTED TO BE ZERO’END IFIF (NOETA. EQ.1) THENWRITE (70,206) GB(N4)ELSEWRITE (70,*) ’ ETA IS RESTRICTED TO BE ZERO’END IFEND IFIF(IBHHH.EQ.I) THENDO 141 I=I,NNII=ICALL DER ( I I, Y, CX)DO 141J=I,NDX(I,J)=-CX(J)

141 CONTINUEDO 142 J=I,NDO 142 K=I,NCOV(J,K)=O.ODO 142 I=I,NNCOV(J,K)=COV(J,K)+DX(I,J)~DX(I,K)

142 CONTINUECALL INVERT(COV,N)DO 143 I=I,NDO 143 J=I,NH(I,J)=COV(I,J)

143 CONTINUEEND IFWRITE (70,406)

406 FORMAT(//,’THE FINAL MLE ESTIMATES ARE :’,/)WRITE (70,404)

301 FORMAT(’ INTERCEPT ’,3E16.8)

47

Page 50: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

302 FORMAT (’303 FORMAT (’304 FORMAT (’3O5 FORMAT (’ MU306 FORMAT (’ ETA

WRITE (70,301)DO 134 I=2,NBWRITE (70,302)

134 CONTINUEWRITE (70,303)WRITE (70,304)IF (NOMU. EQ. 1 )WRITE (70,305)ELSEWRITE (70,’) ’END IF

X’,I2,10X,3EI6.8)SIGMA-SQUARED’,3E16.8)GAMMA ’,3E16.8)

’,3E16.8)’,3E16.8)

Y(1),H(I,I)"O.S,Y{I)/H(I,I)’~O.5

I-I,Y(I),H(I,I)**O.5,Y(I)/H(I,I)’*0.5

Y(NI),H(NI,NI)*’O.5,Y(NI)/H(NI,NI)’’0.5Y(N2),H(N2,N2)’’O.5,Y(N2)/H(N2,N2)*’0.5

Y(N3),H(N3,N3)’’O.5,Y(N3)/H(N3,N3)’~0.5

MU IS REXSTRICTED TO BE ZERO’

IF (NOETA.EQ.I) THENWRITE (70,306) Y(N4),H(N4,N4)’’O.5,Y(N4)/H(N4,N4)~’0.5ELSEWRITE (70,’) ’ ETA IS RESTRICTED TO BE ZERO’END IFIF (IBHHH. EQ.I) TI-I~WRITE(70,421)

421 FORMAT(/,’(NOTE: THE STANDARD ERRORS OF THE ABOVE MLEs CAME’,+ /,’ FROM THE BERNDT, HALL, HALL & HOUSMAN MATRIX)’)ENDIFWRITE (70,501) -FX

501FORMAT(/,’LOG LIKELIHOOD FUNCTION = ’,E16.8)IF(IGRID.EQ.I) THENCHI=2.0"DABS(FX-FXOLS)WRITE(70,5011) CHI

5011 FORMAT(/,’VALUE OF CHI-SQUARE TEST OF ONE-SIDED ERROR =IDF=NOMU+NOETA+IWRITE(70,5012) IDF

5012 FORMAT(’WITH DEGREES OF FREEDOM = ’,If)END IFWRITE (70,502) ITERFORMAT(/,’NUMBER OF ITERATIONS = ’, I3)WRITE(70,420) MAXITFORMAT(/,’(MAXIMUM NUMBER OF ITERATIONS SET AT :’,15,’)’)WRITE (70,511) NNFORMAT(/ ’NUMBER OF FIRMS = ’,13)WRITE(70 512) NPFORMAT(/ ’NUMBER OF PERIODS = ’,I3)WRITE(70 513) NTFORMAT(/ ’TOTAL NUMBER OF OBSERVATIONS = ’,13)WRITE(70 514) NN’NP-NTFORMAT(/ ’THUS THI~ ARE: ’,I3,’ OBSNS NOT IN THE PANEL’)WRITE (70,58)FORMAT(//,’COVARIANCE MATRIX :’,/)FIXFORMATFORMAT(IO(SEI6.8,/))DO 135 I=I,NWRITE (70,52) (H(I,J),J=I,N)

502

420

511

512

513

514

58C

52

48

Page 51: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

135 CONT I NUEIF (IBHHI4. EQ. 1) THENWRITE(70, ")WRITE(70,’) ’ (NOTE:ENDIF

THIS IS THE BKHH COV MATRIX)’

IF (NOETA.EQ.O) WRITE(70,503)503 FORMAT(///,’TECHNICAL EFFICIENCY ESTIMATES :’,/)504 FORMAT(//,’TECKNICAL EFFICIENCY ESTIMATES FOR YEAR ’,I3,’ :’)

68 FORMAT(/,’ FIRM-NO. TECH.-EFF.-EST.’,/)69 FORMAT(5X, I3,9X,EI6.8)

505 FORMAT(SX, I3,4X,’NO OBSERVATION IN THIS PERIOD’)FNP=DFLOAT(NP)DO 138 L=I,NPIF (NOETA.EQ.I) WRITE(70,504) LWRITE(70,68)T=DFLOAT(L)ETA=DEXP(-Y(N4)’(T-FNP))DO 136 I=I,NNIF ((XX(I,L,I).EQ.I.O).OR.(NOETA.EQ.O)) THENFI=(Y(N3)’(I.O-Y(N2))-Y(N2)’EPR(I,Y))/(I.O+(EPE(I,Y)-I.O)~Y(N2))SI2=Y(N2)’(I.O-Y(N2))’Y(NI)/(I.O+(EPE(I,Y)-I.O)’Y(N2))SI=SI2"’0.5TEI=(I.O-DIS(SI’ETA-FI/SI))/(I.O-DIS(-FI/SI))TEI=TEI’DEXP(-FI’ETA+O.5"SI2"ETA’’2)WRITE(70,69) I,TEIELSEWRITE(70,505) IEND IF

136 CONTINUEZ=Y(N3)/(Y(NI)’Y(N2))’~0.5TE=(I.O-DIS(ETA’(Y(N2)"Y(NI))’’O.5-Z))/(I.O-DIS(-Z))TE=TE’DEXP(-ETA’Y(N3)+O.5"Y(N2)’Y(NI)’ETA’’2)WRITE(70,67) TE

67 FORMAT(//,IX,’MEAN TECHNICAL EFF.=’,EI6.8,////)IF (NOETA.EQ.O) GOTO 71

138 CONTINUE71 CONTINUE

C442

C443

WRITE(70,441)441FORMAT(’SUMMARY OF PANEL OF OBSERVATIONS:’,/,

+ ’(1=OBSERVED, O=UNOBSERVED)’,/)DO 449 L=I,NPMT(L)=L

449 CONTINUEWRITE(70,442) (MT(L),L=I,NP)FIXFORMATFORMAT(’ T:’,lOOI4)WRITE(70,’) ’ N’FIXFORMATFORMAT(10214)DO 450 I=I,NNWRITE(70,443) I,(INT(XX(I,L,1)),L=I,NP),M(I)

450 CONTINUE

49

Page 52: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

451

444

445

DO 451L=I,NPMT(L)=ODO 451 I=I,NNMT(L)=MT(L)+INT(XX(I,L,I))CONTINUEWRITE(70,444) (MT(L),L=I,NP),NTFIXFORMATFORMAT(/,4X, IOII4)WRITE(70,445)FORMAT(////)

END

SUBROUTINE GRIDC Does a grid search

IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER(KI=IOO,K2=20,K3=I6,K4=K3+4)COMMON/ONE/X(K4),Y(K4),S(K4),FX,FYCOMMON/T}{REE/N,NFUNCT,NDRV, ITER, INDIC, IPRINT, IGRID,MAXIT

COMMON/FR/M(KI),XX(KI,K2,K3),YY(KI,K2),NN,NT,NP,NOMU,NOETA,NBCOMMON/FIVE/TOL,TOL2,BIGNUM,STEPI,IGRID2,GRIDNO,GWIDTH, IBHHHCOMMON/SEVEN2OB(K4),GB(K4),SV(K4),OBSE(K4)DATA PI/3.1415926/DIMENSION A(K4,K4),B(K4,K4),C(K4,K4),XB(KI,K3)NI=NB+IN2=NB+2N3=NB+3N4=NB+4IF (NOMU.EQ.O) THENN4=N3N3=NB+4END IFF=DFLOAT(NN)FNT=DFLOAT(NT)CALL OLS(OB,OBSE)DO 131 I=I,NY(I)=OB(I)

131 CONTINUEBO=Y(1)VAR=Y(NI)FX=BIGNUMDO 151 I=I,NNDO 151J=I,NBXB(I,J)=0.ODO 152 L=I,NPXB(I,J)=XB(I,J)+XX(I,L,J)

152 CONTINUEXB(I,J)=XB(I,J)/DFLOAT(M(I))

151 CONTINUEDO 132 L=I,NBDO 132 K=I,NBA(L,K)=O.OB(L,K)=O.O

5O

Page 53: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

C(L,K)=O.ODO 132 I=I,NNDO 132 J=I,NPA(L,K)=A(L,K)+XX(I,J,L)’XX(I,J,K)

132 CONTINUECALL INVERT(A,NB)DO 133 I:I,NNDO 133 L=I,NBDO 133 K=I,NBB(L,K)=B(L,K)+XB(I,L)’XB(I,K)

133 CONTINUE

DO 13~ L=I,NBDO 135 K=I,NBDO 135 I=I,NBC(L,K)=C(L,K)+A(L,I)’B(I,K)

135 CONTINUETRACE=TRACE+C(L,L)

13~ CONTINUER=(FNT-(FNT/F)’’2"TRACE)/(FNT-DFLOAT(NB))DEV=O.ODEV2=O.OIF (NOMU. EQ.I) DEV=2.’Y(NI)~O.5IF (NOETA.EQ.I) DEV2=GWIDTHGYS=2.0"GWIDTH’GRIDNOGY7=2.0"2.0"Y(NI)’~O.S~GRIDNOY6B=GRIDNOY6T=I.0-GRIDNODO 136 YS=-DEV2,DEV2,GY8Y(N4)=Y8DO 136 Y7=-DEV,DEV,GY7Y(N3)=Y7DO 137 Y6=Y6B,Y6T,GRIDNOY(N2)=Y6Y(NI)=VAR/(I.+(R’((PI-2.)/PI)-I.)’Y(N2))Z=Y(N3)/(Y(N2)’Y(NI))’’0.5Z=(Y(N2)’Y(NI))’’O.5"DEN(-Z)/(I.-DIS(-Z))Y(1)=BO+Y(N3)+ZCALL FUN (Y, FY)I F (FY. LT. FX) THENFX=FYDO 138 I=I,NX(I)=Y(I)

138 CONTINUEEND IF

137 CONTINUE136 CONTINUE

IF(IGRID2.EQ.I) THENTEMP=GRIDNO/2.0TEMP2=GRIDNO/2.0IF (NOMU.EQ.O) TEMP=O.IF (NOETA.EQ.O) TEMP2=O.AAI=X(N3)-TEMPAA2=X(N3)+TEMP

51

Page 54: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

C

141

c14o139

142

AA3=GRIDNO/5.0CCI=X(N4)-TEMP2CC2=X(N4)+TEMP2CC3=AA3BBI=X(N2)-GRIDNO/2.0BB2=X(N2)+GRIDNO/2.0BB3=AA3DO 139 YS=CCI,CC2,CC3Y(N4)=Y8DO 139 Y7=AAI,AA2,AA3Y(N3)=Y7DO 140 Y6=BBI,BB2,BB3Y(N2)=Y6Y(NI)=VAPJ(I.+(R’((PI-2.)/PI)-I.)’Y(N2))Z=Y(N3)/(Y(N2)’Y(NI))’’0.5Z=(Y(N2)’Y(NI))’’O.5"DEN(-Z)/(I.-DIS(-Z))Y(1)=BO+Y(N3)+ZIF(Y(1).LT.(BO+DEV)) THENCALL FUN (Y, FY)IF (FY. LT. FX) THEN

DO 1411=I,NX(1)=Y(1)CONTINUEEND IFEND IFCONTINUECONTINUEEND IFDO 142 I=I,NGB(1)=X(I)CONTINUE

END

SUBROUTINE INVERT(XX,N)Finds the inverse of a given matrix.IMPLICIT DOUBLE PRECISION (A-H,O-z)PARAMETER(KI=IOO,K2=20,K3=I6,K4=K3+4)COMMON/FIVE/TOL,TOL2,BIGNUM,STEPI,IGRID2,GRIDNO,GWIDTH, IBHHHDIMENSION XX(K4,K4),IPIV(K4)DO 11=I,N

1 IPIV(1)=ODO II I=I,N

DO 5 J=I,NIF(IPIV(J))2,2,5

2 IF(DABS(XX(J,J))-AM~) 4,4,33 ICOL=J

AMAX=DABS(XX(J,J))4 CONTINUE5 CONTINUE

52

Page 55: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

IPIV(ICOL)=IIF(AMAX-I.0/BIGNUM)6,6,7

6 WRITE(6,’) ’SINGULAR MATRIX’STOP

7 CONTINUEAMAX=XX(ICOL, ICOL)XX(ICOL, ICOL)=I.ODO 8 K=I,N

8 XX(ICOL,K)=XX(ICOL,K)/AMAXDO 11J=I,NIF(J-ICOL)9,11,9

9 AMAX=XX(J,ICOL)XX(J,ICOL)=O.DO 10 K=I,N

10 XX(J,K)=XX(J,K)-XX(ICOL,K)’AMAX11 CONTINUE

END

SUBROUTINE OLS(OB,OBSE)C Calculates the OLS estimates and their SEs.

IMPLICIT DOUBLE PRECISION (A-H,O-Z)PARAMETER(K1=I00,K2=20,K3=I6,K4=K3+4)COMMON/THREE/N,NFUNCT,NDRV, ITER, INDIC, IPRINT, IGRID,MAXIT

COMMON/FR/M(KI),XX(KI,K2,K3),YY(KI,K2),NN,NT,NP,NOMU,NOE~A,NBDIMENSION OB(K4),XPX(K4,K4),XPY(K4),OBSE(K4),MX(K4)

C Calculate X’X and X’yDO 1311=I,NBDO 132 J=I,NBXPX(I,J)=O.ODO 132 K=!,NNDO 132 L=I,NPXPX(I,J)=XPX(I,J)+XX(K,L,I)~XX(K,L,J)

132 CONTINUEXPY(I)=O.ODO 131K=I,NNDO 131L=I,NPXPY(I)=XPY(I)+XX(K,L,I)’YY(K,L)

131 CONTINUEC Determine correct scaling for X’X

DO 120 I=I,NBH=(I.0-DLOGI0(XPX(I,I)))/2.0IF (H.LT.0.0) GOT0 121MX(1)=HGOTO 120

121 MX(1)=H-I120 CONTINUE

C Scale, invert and then scale backIS=0

123 IS=IS+IDO 122 I=I,NBDO 122 J=I,NBXPX(I,J)=XPX(I,3)’I0.0~’(MX(I)+MX(3))

53

Page 56: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

122 CONTINUEIF (IS.EQ.I) THENCALL I NVERT (XPX, NB )GOTO 123ENDIF

C Calculate b=inv(X’X)X’yDO 133 I=I,NBOB(I)=O.ODO 133 J=I,NBOB(1)=OB(1)+XPX(I,J)’XPY(J)

133 CONTINUESS=O.ODO 134 K=I,NNDO 134 L=I,NPEE=YY(K,L)DO 135 I=I,NBEE=EE-XX(K,L,I)’OB(1)

135 CONTINUESS=SS+EE’’2

134 CONTINUEOB(NB+I)=SS/(NT-NB)DO 136 I=I,NBOBSE(1)=(OB(NB+I)’XPX(I,I))’~0.5

136 CONTINUE

END

54

Page 57: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

WORKING PAPERS IN ECONOMETRICS AND APPLIED STATISTICS

~024/,~ $J2%ea~ ~ad~. Lung-Fel Lee and William E. Grlffiths,No. I - March 1979.

Howard E. Doran and Rozany R. Deen, No. 2 - March 1979.

g ~ole on ~ Z~ ~~ ~n en ~ @~ Made!.Willlam Grlfflths and Dan Dao, No. 3 - Aprll 1979.

A~. G.E. Battese and W.E. Griffiths, No. 4 - April 1979.

D.S. Prasada Rao, No. 5- April 1979.

Re~ Reg~ ~ada~. George E. Battese andBruce P. Bonyhady, No. 7 - September 1979.

Howard E. Doran and David F. Willlams, No. 8 - September 1979.

D.S. Prasada Rao, No. 9 - October 1980.

~ Do/~ - 1979. W.F. Shepherd and D.S. Prasada Rao,No. 10 - October 1980.

~a~ YLma-$eaiaa and ~aaaa-ge~ Data~ gatLmaZea 9~ ~unc2ina~ ~o~ and ~e@~ ~aru~L~ R~. W.E. Griffiths andJ.R. Anderson, No. II - December 1980.

£0~-0~-Y~ Yemi~nZAegaaa~_ar_e~Rei~u~e~i2~. Howard E. Doranand Jan Kmenta, No. 12 - April 1981.

~ Oax:i,e~ ~ DL~tu2~. H.E. Doran and W.E. Griffiths,No. 13 - June 1981.

Pauline Beesley, No. 14 - July 1981.

$ole~ D~. George E. Battese and Wayne A. Fuller, No. 15 - February1982.

55

Page 58: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

~)ec~. H.I. Tort and P.A. Cassidy, No. 16 - February 1985.

H.E. Doran, No. 17 - February 1985.

J.W.B. Guise and P.A.A. Beesley, No. 18 - February 1985.

W.E. Griffiths and K. Surekha, No. 19- August 1985.

YnZe~ ~afca~. D.S. Prasada Rao, No. 20- October 1985.

H.E. Doran, No. 21- November 1985.

~ae-~ex~g~~xy~Ae~~ed2/. William E. Griffiths,R. Carter Hill and Peter J. Pope, No. 22 - November 1985.

William E. Grifflths, No. 23 - February 1986.

~ ~ 8a~. T.J. Coelli and G.E. Battese. No. 24 -February 1986.

?a~ ~a~ ~ain~ ~ D~. George E. Battese andSohail 3. Malik, No. 25 - April 1986.

George E. Battese and Sohail J. Malik, No. 26 - April 1986.

George E. Battese and Sohall J. Malik, No. 27 - May 1986.

George E. Battese, No. 28- June 1986.

~u~. D.S. Prasada Rao and J. Salazar-Carrillo, No. 29 - August1986.

~~ ~eo~ an ~n~ g~ti~in an ~(I) gaa~y~ ~ed~. H.E. Doran,W.E. Griffiths and P.A. Beesley, No. 30 - August 1987.

William E. Griffiths, No. 31 - November 1987.

56

Page 59: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

Sea~ ~v~ ~Sa& ~. Chris M. Alaouze, No. 32 - September, 1988.

G.E. Battese, T.J. Coelll and T.C. Colby, No. 33- January, 1989.

~RONS8~R. Tim J. Coelli, No. 34- February, 1989.

~a~nb~~a~a~gc~-~ixle~ade~. Colin P. Hargreaves,No. 35 - February, 1989.

William Grlfflths and George Judge, No. 36 - February, 1989.

MP42~-o2i~Ze ~aZea ~ ~ru~. Chris M. Alaouze, No. 38 -July, 1989.

Chris M. Alaouze and Campbell R. Fitzpatrick, No. 39 - August, 1989.

~oia. Guang H. Wan, William E. Grlfflths and Jock R. Anderson, No. 40 -September 1989.

o~ Y/~ Rea~ O~.nx~x~n. Chris M. Alaouze, No. 41 - November,1989.

~ad&mp~ YAe~ and ~b~ ~muaarj~. William Griffiths andHelmut L~tkepohl, No. 42 - March 1990.

Howard E. Doran, No. 43 - March 1990.

~air~ Y/re Xagman ~i&tea~ ~~ ~u&-gap~. Howard E. Doran,No. 44 - March 1990.

Rea~. Howard Doran, No. 45 - May, 1990.

Howard Doran and Jan Kmenta, No. 46 - May, 1990.

8nZaanz2A~ ~argJiaa and $~ ~aizaa. D.S. Prasada Rao andE.A. Selvanathan, No. 47 - September, 1990.

57

Page 60: Maximum-Likelihood Estimation of Stochastic Frontier ...€¦ · 3.2 TKE THREE-STEP ESTIMATION METHOD The program will follow a three-step procedure in estimating the maximum-likelihood

~~ ~ ~/ ~ ~ ~ Ne~s ~~. D.M. Dancer andH.E. Doran, No. 48- September, 1990.

D.S. Prasada Rao and E.A. Selvanathan, No. 49 - November, 1990.

Howard E. Doran, No. 52 - May 1991.

g~ o~ ~ ~ and ~ ~x~u~a ~~:~on~ ~. C.J. O’Donnell and A.D. Woodland,No. 53 - October 1991.

¯ ~ Sec~. C. Hargreaves, J. Harrington and A.M.

Siriwardarna, No. 54 - October, 1991.

Demand ~a m~na~x~n gceanm~-1~ale ~ea~_Ia:Colin Hargreaves, No. 55 - October 1991.

~~ ~~ ~anota~, y~ g~/ir.~ and ~u~_/ D~k~: W~A~Lc~ ~ ~add9 Yannten~ O% ~ndLa. G.E. Battese and T.J. Coelli,No. 56 - November ~99~.

58