SHAZAM Community
Ask Your Question
1

Can SHAZAM do Stochastic Frontier Analysis (SFA)?

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

Keiji gravatar image

Can SHAZAM do Stochastic Frontier Analysis (SFA)?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2011-07-10 18:47:35 +0000

updated 2011-10-28 11:13:26 +0000

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:

http://www.uq.edu.au/economics/cepa/frontier.htm

Some of his examples use SHAZAM.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

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

Seen: 1,577 times

Last updated: Oct 28 '11