Monday, June 3, 2013

GRAS (Generalized RAS) Example

 

$ontext

   
Generalized RAS method

   
THEO JUNIUS & JAN OOSTERHAVEN
   
The Solution of Updating or Regionalizing a Matrix
   
with both Positive and Negative Entries
   
Economic Systems Research, Vol. 15, No. 1, 2003

   
Lenzen, M., Wood, R. and Gallego, B. (2007)
   
Some comments on the GRAS method,
   
Economic Systems Research, 19, pp. 461–465

$offtext


table IO_0(*,*) 'Initial, old input–output table'
             
Goods  Services  Consumption  NetExports TotalOutput
Goods           7      3            5         -3           12
Services        2      9            8          1           20
NetTaxes       -2      0            2          1            1

TotalUse        7     12           15         -1           33
ValueAdded      5      8            0          0           13
TotalInput     12     20           15         -1
;


table IO_1(*,*)  'Row and column totals of the new, to be updated, input–output table'
             
Goods  Services  Consumption  NetExports TotalOutput
Goods                                                      15
Services                                                   26
NetTaxes                                                   -1

TotalUse        9     16           17         -2           40
ValueAdded      6     10            0          0           16
TotalInput     15     26           17         -2
;


sets
  i
/Goods,Services,NetTaxes/
  j
/Goods,Services,Consumption,NetExports/
;

parameter
   a(i,j) 
'old matrix'
   u(i)   
'new row sum'
   v(j)   
'new column sum'
   e      
'1 or exp(1) depending on paper'
;
a(i,j) = IO_0(i,j);
u(i) = IO_1(i,
'TotalOutput');
v(j) = IO_1(
'TotalUse'
,j);

* Junius/Oosterhaven:

* e = 1;
* Lenzen,e.a.:
e = exp(1);

display a,u,v;

variables

   z(i,j)  
'note: z(i,j)=x(i,j)/a(i,j)'
   obj
;


equations
   objective
   rowsum(i)
   colsum(j)
;

objective.. obj =e=
sum((i,j),abs(a(i,j))*z(i,j)*log(z(i,j)/e));

rowsum(i)..
sum
(j,a(i,j)*z(i,j)) =e= u(i);

colsum(j)..
sum
(i,a(i,j)*z(i,j)) =e= v(j);


z.L(i,j) = 1;
z.lo(i,j) = 0.0001;


model m /all/
;
solve
m using nlp minimizing obj;

IO_1(i,j) = z.l(i,j)*a(i,j);


display
IO_0,IO_1;

Notes:

  • We can declare z(i,j)=x(i,j)/a(i,j) as a positive variable.
  • This makes things sign preserving.
  • z(i,j)’s will not be generated if a(i,j)=0. Some papers mention we should set z(i,j)=1 if a(i,j)=0 but here we just omit all these entries.
  • In the results below GAMS is truncating labels while there is in fact enough room to print them completely (or: counting is difficult!). I even reported this little fact to the GAMS people.

Results:

----     89 PARAMETER IO_0  Initial, old input–output table

                 Goods    Services  Consumpti~  NetExports  TotalOutp~

Goods            7.000       3.000       5.000      -3.000      12.000
Services         2.000       9.000       8.000       1.000      20.000
NetTaxes        -2.000                   2.000       1.000       1.000
TotalUse         7.000      12.000      15.000      -1.000      33.000
ValueAdded       5.000       8.000                              13.000
TotalInput      12.000      20.000      15.000      -1.000


----     89 PARAMETER IO_1  Row and column totals of the new, to be updated, input–output table

                 Goods    Services  Consumpti~  NetExports  TotalOutp~

Goods            8.976       3.743       5.722      -3.441      15.000
Services         2.799      12.257       9.992       0.952      26.000
NetTaxes        -2.776                   1.286       0.490      -1.000
TotalUse         9.000      16.000      17.000      -2.000      40.000
ValueAdded       6.000      10.000                              16.000
TotalInput      15.000      26.000      17.000      -2.000

No comments:

Post a Comment