# Can SHAZAM do Stochastic Frontier Analysis (SFA)?

Can SHAZAM do Stochastic Frontier Analysis (SFA)?

edit retag close merge delete

Sort by ยป oldest newest most voted

Yes, this can be done with some fairly straightforward coding.

Here is an example using the data from Greene to estimate Cost Functions with the half Normal Model. You can easily change the density function equation to fit any other type of model.

The files needed for this example are:

frontier.sha

industry.shd

The example .sha file looks like this:

* Stochastic Frontier Model
* Reference: William H. Greene, Econometric Analysis, Fourth Edition,
*            Prentice-Hall, 2000.
*            Section 9.7.1, pp. 394-397.
sample 1 25
format (a8,a4,1x,f10.0,f12.0,f11.0,f13.0)
read (industry.shd) state1-state2 q k l nf / skipline=1 format
genr lq=log(q)
genr lk=log(k)
genr ll=log(l)

* Least Squares
ols lq lk ll / coef=bols
gen1 sig=sqrt($sig2) * Set starting values for the non-linear estimation dim beta 5 gen1 beta:2=bols:3 gen1 beta:3=bols:1 gen1 beta:4=bols:2 gen1 beta:1=sig gen1 beta:5=1 genr constant=0.5*log(2/$pi)

* Define the regression function in a character string
error: (lq-(b0+bk*lk+bl*ll))

* Specify the density function for the "half-normal" model.
* Use the LOGDEN option on the NL command.
nl 1 / ncoef=5 logden start=beta coef=bnew
eq constant - 0.5*log(sigma**2) - 0.5*([error]/sigma)**2 &
+ log(ncdf(-[error]*lambda/sigma))
end

* Recover an estimate for sigma_v (reported as TEST VALUE).
test (sigma*sigma/(1+lambda*lambda))**0.5

* Recover an estimate for sigma_u
test (sigma*sigma*lambda*lambda/(1+lambda*lambda))**0.5

* Calculate the estimated inefficiencies
gen1 sigma=bnew:1
gen1 lambda=bnew:5
genr z=(lq-(bnew:2+bnew:3*lk+bnew:4*ll))*lambda/sigma
?distrib z / pdf=pdfz
genr u=sigma*lambda/(1+lambda*lambda)*(pdfz/(1-ncdf(z))-z)
format(1x,a8,a4,f12.4)
print state1-state2 u / format
stop


You can also look at Tim Coelli's excellent implementation here:

Some of his examples use SHAZAM.

more

## Stats

Asked: 2011-07-09 22:26:56 +0000

Seen: 4,416 times

Last updated: Oct 28 '11