**PECULIARITIES OF GTAP AGGREGATION ****WITH REGARD TO THE PROBLEM OF ‘SELF-TRADING’**

**VLADIMIR SEDALISCHEV****RUSSIAN PRESIDENTIAL ACADEMY OF NATIONAL ECONOMY AND PUBLIC ADMINISTRATION UNDER THE PRESIDENT OF THE RUSSIAN FEDERATION****SEDALISCHEV-VV@RANEPA.RU****BEKHAN CHOKAEV****RUSSIAN PRESIDENTIAL ACADEMY OF NATIONAL ECONOMY AND PUBLIC ADMINISTRATION UNDER THE PRESIDENT OF THE RUSSIAN FEDERATION****CHOKAEV@RANEPA.RU**

*Abstract:* The present paper deals with the problem of ‘self-trading ’ that occurs when compiling a database for a set of economic sectors and regions by aggregating the data from an existing general database. The nature of the problem is that combining several countries into a region means that all trade is carried out within one region that, as it were, trades with itself, which can distort the picture of reality obtained using a model based on such data. The paper presents an algorithm for aggregating the GTAP database which solves the problem of ‘self-trading’, and provides its source code in the GAMS programming language.

*Keywords:* Computable General Equilibrium, GTAP database, database aggregation, problem of ‘self-trading’

*JEL Classifications*: C68, F15, F17

SEDALISCHEV, VLADIMIR. CHOKAEV, BEKHAN (2016) "PECULIARITIES OF GTAP AGGREGATION WITH REGARD TO THE PROBLEM OF ‘SELF-TRADING’". Journal of Russian Review (ISSN 2313-1578), VOL. 1(4), 37-48

**1. Introduction and literature review**

Among the tools used for evaluating the outcomes of trade deals, the Computable General Equilibrium model with its structural equations presenting the equilibrium of all markets, is one of the most popular. It makes it possible to analyse how various external economic changes influence a nation’s economy (Fossati & Wiegard, 2003), (De Melo, 1989). There are certain assumptions made when choosing the equations, as to the technology and factors of production, agents’ preferences, government’s economic policy, level of competition and others. Currently the most popular models are those based on the assumption of perfect competition and accumulation of capital (Burfisher, 2011), (Dixon & Jorgenson, 2012).

In contrast to econometric models, CGE enables evaluating the outcomes of a government’s economic policy and analysing the changes in macrovariables like GDP, export, and import. In addition to that, CGE helps identify potential sector-level changes in economic indicators. This enables one to analyse the results of changes in government’s economic policy, including the creation of free trade areas, for ‘winner’ and ‘looser’ industries. As a result, it is easier to see which industries require separate trade deals (Кнобель & Чокаев, 2014).

One of the features of integration effects-oriented computable general equilibrium models is using large bodies of input data: for each country and each economic sector there is import, export, production, consumption and other types of data, both in real and in nominal values. Moreover, there is a multitude of input parameters describing the behaviour of the model’s economic agents, such as elasticity of substitution in individual utility function, and parameters describing capital intensity of industry sectors, tax rates, import tariffs etc. Since creating such a comprehensive database is a separate and quite labour-intensive task, the majority of CGE-based studies use ready-made databases like GTAP. In its latest version (v9.0), GTAP contains data on 140 countries and 57 sectors.

Each researcher using the GTAP database for CGE modelling decides how it should be broken down into regions and economic sectors, according to his or her research goal. Most often, this breakdown is much more aggregated than the default one (140 countries and 57 sectors). This requires combining countries into regions and industry groups into larger branches using specialised GTAP aggregation utilities. However, such software utilities usually fail to account for the problem of ‘self-trading’. The nature of this problem is that combining several countries into a region results in its trading with itself, which can distort the output of a model based on such data. The aim of the present paper is to develop an algorithm for aggregating the GTAP database which solves the problem of ‘self-trading’ and to code it using the GAMS programming language.

**2. GTAP database aggregation algorithm**

Popular GTAP aggregation utilities like GTAPAgg and FlexAgg are producing incorrect results for regions aggregated due to the so-called ‘self-trading’ (see (Hamdi-Cherif & Ghersi, 2012) for more details). This problem occurs when simply summing up non-zero trade flows to and from the aggregated regions, which results in distorted rates for some taxes, incorrect openness ratios, overstated expenditure and revenue figures for the aggregate region, as well as distorted shares of resource flows.

The paper referred to above (Hamdi-Cherif & Ghersi, 2012) proposed a method of aggregating GTAP values that produced matrixes in the System of National Accounts (SNA), the standard 1993 United Nations format. However, there are different CGE models that use GTAP data, and one cannot enter such data, presented as a SNA-style matrix, into a model calibrated for other types of matrices or not designed for explicitly matrix-style GTAP data input at all. A special mention should be made of its dedicated account for interregional import/export taxes, one that is simply not present by default in CGE models based on GTAP data aggregated by standard utilities.

Also note that applying the algorithm suggested by Hamdi-Cherif & Ghersi (2012) to cases where the sectors imposing transportation margin are experiencing a trade balance deficit may produce negative export figures, which a number of CGE models classify as incorrect input.

To remedy the problem, the algorithm from Hamdi-Cherif & Ghersi was modified so that it could produce data in the default GTAP format that can be used by any GTAP-based CGE model, free from transportation and separate internal trade tax issues. The equations representing the transformations will be written using the standard GTAP variable notation. For more information on these variables one can refer to, for example, Hertel, 1997.

This is a step-by-step description of the way the algorithm from (Hamdi-Cherif & Ghersi, 2012) was modified.

**Step 1:** Summing up all GTAP variables according to the chosen aggregation scheme. This step mimics the output of aggregation utilities like GTAPAgg, FlexAgg, SAMGator (used for preparing the input data for the GLOBE model). That means the aggregated GTAP data would be suffering from the problem of ‘self-trading’. This will later be corrected without any additional input of data.

**Step 2:** Calculating the ‘self-import’ share for each sector i of the aggregated region r in the total value of imports of sector i, region r in market prices:

In a similar manner, calculating the share of transport margins paid to the global transportation services sector t for ‘self-importing’ by sector i, region r:

Henceforward, for the sake of brevity, let *S _{VNWR}(i,j,r)=0 *for all non-transportation sectors i. After Step 2 is completed for each aggregated region r, comes

**Step 3:** Calculating for each sector i total tax on ‘self-trade’ for each region r as the sum of all taxes on ‘home’ import and ‘home’ export:

**Step 4:** Calculating the indicator for (flagging up) deficit in transportation sector for each aggregated region r, that is, initialising the variable *I _{d}(t,r)* as

The deficit here is region r exporting into the global transportation sector less in terms of t transportation costs than it uses when importing goods.

**Step 5:** Transforming the export of transportation services variable VST(t,r) for all the aggregated regions r in the following manner, depending on the value of the flag I_{d}(t,r):

- If the region r has no t transportation services deficit (
*I*), the export of these services is recalculated as:_{d}(t,r)=0

This transformation assumes that all ‘self-importing’ transportation within the aggregated region was done using only its own internal transportation industry.

- If, however, the region r is experiencing a t transportation services deficit (
*I*), then the share of the rest of the regions in the global t transportation services sector is recalculated as:_{d}(t,r)=1

then, to avoid skewing the values, the value of the t transportation services deficit *D _{VST}(t,r)* is found (which will later be distributed across other regions to make the global transportation sector balanced):

Assuming that the share of internally-commissioned import transportation services was equal to the region’s share in the global transportation sector *1-s _{VST}(t,r)*, the figure (which will remain unchanged throughout the rest of the steps, unlike that of deficit-free regions) for the deficit-affected aggregated region’s global transportation services export will be

Henceforward, for the sake of brevity, let for all non-transportation sectors i.

**Step 6:** Zeroing out external trade of the aggregated region with itself:

and the transportation margins for ‘self-import’:

**Step 7:** Adding the share of import consumption (both intermediate and final) into domestic consumption of the aggregated region r for each sector i:

Note that the share that was transferred into domestic consumption is exactly equal to the ‘self-trade’ shares of the free-on-board (FOB) imports and import taxes.

**Step 8:** Transferring ‘self-import’ sector t transportation margins into sector t transportation costs for the aggregated region r:

**Step 9:** Finding the transferred consumption, transportation margins, and import taxes values from import consumption (both intermediate and final):

**Step 10:** For every s and r region with *I _{d}(t,r)=0 *and

*I*, ‘deanonymising’ (by reallocating the corresponding ‘anonymous’ portion of VST into transportation services trade) the deficit portion of the global t transportation services by distributing the corresponding global deficit of transportation sector t among the deficit-free regions according to their input into global transportation services:

_{d}(t,r)=1**Step 11:** Recalculating the export of transportation services into the global transportation sector for all transportation sectors t in t deficit-free (that is, with *I _{d}(t,r)=0*) regions r value as

**Step 12:** Finalising the corrected GTAP aggregation algorithm keeping in mind that import consumption (both intermediate and final) still includes taxes on ‘self-import’. Similarly, domestic consumption still includes taxes on ‘self-export’. Correcting this oversight by transferring these taxes into corresponding sales taxes in the following manner:

**3. Conclusion**

The proposed algorithm for overcoming the problem of ‘self-trade’, as set out above, is presented in 12 steps, application of which results in data that retains the sector-level values of production, added value, taxes (excluding those on ‘self-trade’, of course). Values of aggregated consumption, government expenditure and others are likewise unchanged.

Despite its merits, this approach in not without its limitations. The aggregated GTAP data was corrected on the assumption that the way in which ‘transferred’ bits of various aggregated variables were distributed was proportionate to that of the initial data. In real life this might obviously not be the case. Still, since GTAP does not, for example, offer any information on import consumption by region, this assumption seems reasonable enough. In addition, redistribution by default of all ‘self-import’ transportation margins into the region’s transportation services is also open to criticism. One possible justification in this case is, once again, the lack of more detailed information on transportation margins. This is recognised when building GTAP itself (Hertel, 1997), where the total value of exports in the global pool of transportation services is calculated using the proportions of volumes of transportation services exports in the regions.

Therefore, using this algorithm to overcome the problem of ‘self-trade’ leads to fewer distortions in tax rates used in CGE models, as well as in shares of import and export.

**4. References**

- Burfisher, M. E. (2011). Introduction to Computable General Equilibrium Models. Cambridge University Press.
- De Melo, J. (1989). Computable general equilibrium models for trade policy analysis in developing countries: A survey. Journal of Policy Modeling, 10(4), 469-503.
- Dixon, P. B., & Jorgenson, D. W. (2012). Handbook of Computable General Equilibrium Modeling. Newnes.
- Fossati, A., & Wiegard, W. (2003). Policy Evaluation with Computable General Equilibrium Models. Routledge.
- Hamdi-Cherif, M., & Ghersi, F. (04 2012 г.). Correcting the ‘self-trade’ issue in the GTAPAgg software - Technical paper. CIRED Working Papers.
- Hertel, T. W. (1997). Global trade analysis: modeling and applications. Cambridge university press.
- Knobel’, A. Ju., & Chokaev, B. V. (2014). Vozmozhnye jekonomicheskie posledstvija torgovogo soglashenija mezhdu Tamozhennym i Evropejskim sojuzami. Voprosy jekonomiki (2), 68-87.

**5. Appendices**

**Appendix 1. The algorithm’s code in GAMS**

$title Read the FLEXAGG aggregated dataset and correct «self-trade» issue

* Step 1 (loading GTAP data aggregated by simple sum):

$gdxin Aggregated_input.gdx

Sets

REG

PROD_COMM

TRAD_COMM(PROD_COMM)

ENDW_COMM

MARG_COMM(TRAD_COMM);

alias (REG,r,s,rr);

alias (REG,r,s,rr), (TRAD_COMM,i,j,ii), (f,ENDW_COMM);

Parameters

VDGA(i,r) Government - domestic purchases at agents’ prices

VIGA(i,r) Government - imports at agents’ prices

VDGM(i,r) Government - domestic purchases at market prices

VIGM(i,r) Government - imports at market prices

VDPA(i,r) Private households - domestic purchases at agents’ prices

VIPA(i,r) Private households - imports at agents’ prices

VDPM(i,r) Private households - domestic purchases at market prices

VIPM(i,r) Private households - imports at market prices

EVOA(f,r) Endowments - output at agents’ prices

EVFA(f,i,r) Endowments - firms’ purchases at agents’ prices

VFM(f,i,r) Endowments - Firms’ purchases at market prices

VDFA(i,j,r) Intermediates - firms’ domestic purchases at agents’ prices

VIFA(i,j,r) Intermediates - Firms’ imports at agents’ prices

VDFM(i,j,r) Intermediates - firms’ domestic purchases at market prices

VIFM(i,j,r) Intermediates - firms’ imports at market prices

VIMS(i,r,s) Trade - bilateral imports at market prices

VIWS(i,r,s) Trade - bilateral imports at world prices

VXMD(i,r,s) Trade - bilateral exports at market prices

VXWD(i,r,s) Trade - bilateral exports at world prices

VST(i,r) Trade - exports for international transportation

VTWR(i,j,r,s) Trade - Margins for international transportation at world prices

FTRV(f,i,r) Taxes - factor employment tax revenue

VDEP(r) Capital depreciation

;

$load PROD_COMM TRAD_COMM ENDW_COMM, MARG_COMM REG

$load VDGA VIGA VDGM VIGM VDPA VIPA VDPM VIPM

$load EVOA EVFA VFM VDFA VIFA VDFM VIFM

$load VIMS VIWS VXMD VXWD VST VTWR=VTWRINI FTRV VDEP

$gdxin

alias (MARG_COMM,MARG_COMM_p);

Parameters

share_m(i,r) «Share of ‘self-trade’ in imported goods accounts»

share_VTWR(i,j,r)

share_outer_VTWR(i,r) «Share of transport margins in self-trade that must be distributed across other regions»

Deficit_Flag(i,r) «1 if there is deficit of transport services within the region (vst-owatp<0), else 0»

VSTdeficit(i,r)

HomeTradeTAX_tm(i,r)

HomeTradeTAX_te(i,r)

HomeTradeTAX(i,r)

;

* Step 2:

share_m(i,r)$SUM(s,VIMS(i,s,r)) = VIMS(i,r,r)/SUM(s,VIMS(i,s,r));

share_VTWR(MARG_COMM,TRAD_COMM,r)$SUM(s,VIMS(TRAD_COMM,s,r)) = VTWR(MARG_COMM,TRAD_COMM,r,r)/SUM(s,VIMS(TRAD_COMM,s,r));

* Step 3:

HomeTradeTAX_tm(i,r) = VIMS(i,r,r) - VIWS(i,r,r);

HomeTradeTAX_te(i,r) = VXWD(i,r,r) - VXMD(i,r,r);

HomeTradeTAX(i,r) = HomeTradeTAX_tm(i,r) + HomeTradeTAX_te(i,r);

* Step 4:

Deficit_Flag(MARG_COMM,r)$( VST(MARG_COMM,r)-SUM(j,VTWR(MARG_COMM,j,r,r))<=0 )=1;

* Step 5:

VST(MARG_COMM,r)$( Deficit_Flag(MARG_COMM,r)=0 ) = VST(MARG_COMM,r) - SUM(j,VTWR(MARG_COMM,j,r,r));

share_outer_VTWR(MARG_COMM,r)$Deficit_Flag(MARG_COMM,r) = 1 - VST(MARG_COMM,r)/SUM(rr,VST(MARG_COMM,rr));

VSTdeficit(MARG_COMM,r) = share_outer_VTWR(MARG_COMM,r) * SUM(j,VTWR(MARG_COMM,j,r,r));

VST(MARG_COMM,r)$Deficit_Flag(MARG_COMM,r) = VST(MARG_COMM,r) - (1-share_outer_VTWR(MARG_COMM,r))*SUM(j,VTWR(MARG_COMM,j,r,r));

* Step 6 (zeroing out the region’s external trade itself):

VIMS(i,r,r)=0;

VIWS(i,r,r)=0;

VXMD(i,r,r)=0;

VXWD(i,r,r)=0;

VTWR(i,j,r,r)=0;

* Step 7:

VDFA(i,j,r) = VDFA(i,j,r) + VIFA(i,j,r)*(share_m(i,r)-SUM(MARG_COMM, share_VTWR(MARG_COMM,i,r)));

VDFM(i,j,r) = VDFM(i,j,r) + VIFM(i,j,r)*(share_m(i,r)-SUM(MARG_COMM, share_VTWR(MARG_COMM,i,r)));

VDPA(i,r) = VDPA(i,r) + VIPA(i,r)*(share_m(i,r)-SUM(MARG_COMM, share_VTWR(MARG_COMM,i,r)));

VDPM(i,r) = VDPM(i,r) + VIPM(i,r)*(share_m(i,r)-SUM(MARG_COMM, share_VTWR(MARG_COMM,i,r)));

VDGA(i,r) = VDGA(i,r) + VIGA(i,r)*(share_m(i,r)-SUM(MARG_COMM, share_VTWR(MARG_COMM,i,r)));

VDGM(i,r) = VDGM(i,r) + VIGM(i,r)*(share_m(i,r)-SUM(MARG_COMM, share_VTWR(MARG_COMM,i,r)));

* Step 8 (Transferring transportation margins into domestic transportation services):

VDFA(MARG_COMM,j,r) = VDFA(MARG_COMM,j,r) + (1-share_outer_VTWR(MARG_COMM,r))*SUM(i,VIFA(i,j,r)*share_VTWR(MARG_COMM,i,r));

VDFM(MARG_COMM,j,r) = VDFM(MARG_COMM,j,r) + (1-share_outer_VTWR(MARG_COMM,r))*SUM(i,VIFM(i,j,r)*share_VTWR(MARG_COMM,i,r));

VDPA(MARG_COMM,r) = VDPA(MARG_COMM,r) + (1-share_outer_VTWR(MARG_COMM,r))*SUM(i,VIPA(i,r)*share_VTWR(MARG_COMM,i,r));

VDPM(MARG_COMM,r) = VDPM(MARG_COMM,r) + (1-share_outer_VTWR(MARG_COMM,r))*SUM(i,VIPM(i,r)*share_VTWR(MARG_COMM,i,r));

VDGA(MARG_COMM,r) = VDGA(MARG_COMM,r) + (1-share_outer_VTWR(MARG_COMM,r))*SUM(i,VIGA(i,r)*share_VTWR(MARG_COMM,i,r));

VDGM(MARG_COMM,r) = VDGM(MARG_COMM,r) + (1-share_outer_VTWR(MARG_COMM,r))*SUM(i,VIGM(i,r)*share_VTWR(MARG_COMM,i,r));

* Step 9:

VIFA(i,j,r) = (1-share_m(i,r))*VIFA(i,j,r) + share_outer_VTWR(i,r)*SUM(ii,VIFA(ii,j,r)*share_VTWR(i,ii,r))$MARG_COMM(i);

VIFM(i,j,r) = (1-share_m(i,r))*VIFM(i,j,r) + share_outer_VTWR(i,r)*SUM(ii,VIFM(ii,j,r)*share_VTWR(i,ii,r))$MARG_COMM(i);

VIPA(i,r) = (1-share_m(i,r))*VIPA(i,r) + share_outer_VTWR(i,r)*SUM(ii,VIPA(ii,r)*share_VTWR(i,ii,r))$MARG_COMM(i);

VIPM(i,r) = (1-share_m(i,r))*VIPM(i,r) + share_outer_VTWR(i,r)*SUM(ii,VIPM(ii,r)*share_VTWR(i,ii,r))$MARG_COMM(i);

VIGA(i,r) = (1-share_m(i,r))*VIGA(i,r) + share_outer_VTWR(i,r)*SUM(ii,VIGA(ii,r)*share_VTWR(i,ii,r))$MARG_COMM(i);

VIGM(i,r) = (1-share_m(i,r))*VIGM(i,r) + share_outer_VTWR(i,r)*SUM(ii,VIGM(ii,r)*share_VTWR(i,ii,r))$MARG_COMM(i);

* Step 10:

VXWD(MARG_COMM,r,s)$(not Deficit_Flag(MARG_COMM,r) and Deficit_Flag(MARG_COMM,s))

= VXWD(MARG_COMM,r,s) + VSTdeficit(MARG_COMM,s)*VST(MARG_COMM,r)/SUM((MARG_COMM_p,rr)$(not Deficit_Flag(MARG_COMM_p,rr)),VST(MARG_COMM_p,rr));

VXMD(MARG_COMM,r,s)$(not Deficit_Flag(MARG_COMM,r) and Deficit_Flag(MARG_COMM,s))

= VIMS(MARG_COMM,r,s) + VSTdeficit(MARG_COMM,s)*VST(MARG_COMM,r)/SUM((MARG_COMM_p,rr)$(not Deficit_Flag(MARG_COMM_p,rr)),VST(MARG_COMM_p,rr));

VIWS(MARG_COMM,r,s)$(not Deficit_Flag(MARG_COMM,r) and Deficit_Flag(MARG_COMM,s))

= VIWS(MARG_COMM,r,s) + VSTdeficit(MARG_COMM,s)*VST(MARG_COMM,r)/SUM((MARG_COMM_p,rr)$(not Deficit_Flag(MARG_COMM_p,rr)),VST(MARG_COMM_p,rr));

VIMS(MARG_COMM,r,s)$(not Deficit_Flag(MARG_COMM,r) and Deficit_Flag(MARG_COMM,s))

= VIMS(MARG_COMM,r,s) + VSTdeficit(MARG_COMM,s)*VST(MARG_COMM,r)/SUM((MARG_COMM_p,rr)$(not Deficit_Flag(MARG_COMM_p,rr)),VST(MARG_COMM_p,rr));

* Step 11:

VST(MARG_COMM,r)$(not Deficit_Flag(MARG_COMM,r)) = VST(MARG_COMM,r)

- SUM((MARG_COMM_p,s)$Deficit_Flag(MARG_COMM_p,s),VSTdeficit(MARG_COMM_p,s))*VST(MARG_COMM,r)/SUM((MARG_COMM_p,rr)$(not Deficit_Flag(MARG_COMM_p,rr)),VST(MARG_COMM_p,rr));

* Step 12:

Parameters denominator(i,r) «Sum of intermidiate and final consumption of domestic commodities»;

denominator(i,r) = ( SUM(j,VDFM(i,j,r))+VDPM(i,r)+VDGM(i,r) );

VDFM(i,j,r)$denominator(i,r) = VDFM(i,j,r) - HomeTradeTAX(i,r)*VDFM(i,j,r)/denominator(i,r);

VDPM(i,r)$denominator(i,r) = VDPM(i,r) - HomeTradeTAX(i,r)*VDPM(i,r)/denominator(i,r);

VDGM(i,r)$denominator(i,r) = VDGM(i,r) - HomeTradeTAX(i,r)*VDGM(i,r)/denominator(i,r);

execute_unload ‘Output.gdx’, i=PROD_COMM, TRAD_COMM, ENDW_COMM, MARG_COMM, REG, VDGA, VIGA, VDGM, VIGM, VDPA, VIPA, VDPM, VIPM, EVOA, EVFA, VFM, VDFA, VIFA, VDFM, VIFM, VIMS, VIWS, VXMD, VXWD, VST, VTWR=VTWRINI, FTRV, VDEP;