# Metafrontier and metatechnology estimation

I have tried the following with the Trial version of SHAZAM several times for these commands but it says :syntax error. What could be the cause?

Here is my code.

* The file parMIDA.xlsx contains estimated parameters of group frontiers (by column)

* 1. SET NUMBER OF PARAMETERS ETC
gen1 nparms=36
gen1 ngroups=3
gen1 n1=882
gen1 n2=791
gen1 n3=714

* 2. READ THE ESTIMATED PARAMETERS OF THE GROUP FRONTIERS
sampl 1 nparms
do #=1,ngroups
dim b# nparms
copy parm b# / fcols=#;# tcols=1;1
endo

* 3. READ THE DATA AND CONSTRUCT DATA MATRICES AND VECTORS
gen1 j2=n1+1
gen1 j3=n1+n2+1
gen1 k2=n1+n2
gen1 n=n1+n2+n3
sampl 1 n
read (sfa1.txt) GROUP Y X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 X32 X33 X34 X35
sampl j2 k2
read (sfa2.txt)GROUP Y X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 X32 X33 X34 X35
sampl j3 k3
read (sfa3.txt)GROUP Y X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 X32 X33 X34 X35
sampl 1 n
matrix x = |X1| X2| X3| X4| X5| X6| X7| X8| X9| X10| X11| X12| X13| X14| X15| X16| X17| X18| X19| X20| X21| X22| X23| X24| X25|X26|X27|X28|X29|X30|X31|X32|X33|X34| X35|
dim x1 n1 nparms x2 n2 nparms x3 n3 nparms
copy x x1 / frows=1;n1 trows=1;n1
copy x x2 / frows=j2;k2 trows=1;n2
copy x x3 / frows=j3;k3 trows=1;n3
do# = 1,ngroups
matrix yhat# = x#*b#
endo
matrix b = -(yhat1|yhat2|yhat3)

* 4. OBTAIN AND PRINT PARAMETERS OF THE METAFRONTIER
stat x / means = xbar
matrix c = ((-xbar')|xbar)
*' A
matrix A = (-x)|x
?lp c A b / iter = 5000 primal = bstar
dim beta1 nparms beta2 nparms
gen1 p1 = nparms+1
gen1 p2 = nparms*2
copy bstar beta1 / frows=1;nparms trows=1;nparms
copy bstar beta2 / frows=p1;p2 trows=1;nparms
matrix beta = beta1-beta2
print beta

* 5. OBTAIN AND PRINT METATECHNOLOGY RATIOS
do# = 1,ngroups
matrix xbeta# = x#*beta
matrix mtr# = exp(yhat#)/exp(xbeta#)
stat mtr#
print mtr#
endo
stop

edit retag close merge delete

Sort by » oldest newest most voted

There are a few issues amongst the code including incorrect use of the concatenation command. In addition the Trial version has a limited amount of memory allocated so will not be able to operate on your entire data file.

I recommend you look at the paper by Rao, O'Donnell and Battese titled 'Metafrontier Functions for the Study of Inter-regional Productivity Differences' which has an easy to follow SHAZAM program in the Appendix. The paper can be found here.

The authors of this paper have kindly shared the the Shazam code (metafront.sha), a file containing the group frontier coefficients (parm.txt), plus the data used to estimate the group frontiers (sfa1.txt, …, sfa4.txt) to permit SHAZAM users to reproduce the results in their paper: metafront.zip

more

Except the Trial version has limited amount of memory, I find a problem taht you set the group number equal to 3 ("ngroups=3") but your do-loop number is equal to 1 ("do #=1"?) (it should be "do # = 1,3", the same as your group numbers)

more