!<
    ==================================
    Global Trade Analysis Project
    GTAP-INT: An Intertemporal Version of the GTAPv6.2 Model
    GTAP-INT Version 1 (created from GTAP-INT Version 1-pre)
    January 2025
    ==================================

    For documentation see:
    (a) Van Ha, P., Kompas, T., 2016. "Solving intertemporal CGE models in
    parallel using a singly bordered block diagonal ordering technique."   
    Economic Modelling 52, 3–12. https://doi.org/10.1016/j.econmod.2015.07.011

    (b) Kompas, T., Van Ha, P., 2019. "The ‘curse of dimensionality’ resolved:
    The effects of climate change and trade barriers in large dimensional
    modelling." Economic Modelling 80, 103–110.
    https://doi.org/10.1016/j.econmod.2018.08.011

    (c) Hertel, T.W. and M.E. Tsigas, "Structure of the Standard GTAP Model",
    Chapter 2 in T.W. Hertel (editor,t) "Global Trade Analysis: Modeling and
    Applications", Cambridge University Press, 1997.

    (d) R.A. McDougall, "A New Regional Household Demand System for GTAP",
    GTAP Technical Paper #20, Center for Global Trade Analysis, Purdue
    University

    (e) Hertel T.W., K. Itakura and R.A. McDougall, "GTAP.TAB: The Standard
    GTAP Model" (yet to be drafted), GTAP Technical Paper, Center for Global
    Trade Analysis, Purdue University,
    http://www.agecon.purdue.edu/gtap/techpapr/.  This technical paper
    documents all of the changes since the GTAP book TAB file.


    -------------------------------------
    HISTORY of the GTAP-INT modifications
    -------------------------------------
    Version 1 modified by M. Cantele
        - Syntax, set, and file modifications for compatibility within the
        Trade and Environment Equilibrium Modeling System (TEEMS)

    Version 1-pre developed by T. Kompas and P. Van Ha, 2016:


    ----------------------------
    HISTORY of the standard file
    ----------------------------

    Version 6.2 fixes bugs and provides minor enhancements:
        - EV_ALT, CNTdpar fix
        - SX_IR fix
        - new treatment of export and import tariffs
        - original levels defined for power-of-tax variables
        - CNTalleffir range extended from TRAD_COMM to DEMD_COMM
        - INCOME formula, quantity index equations more AnalyzeGE-friendly

    Version 6.1 fixes bugs in 6.0:
        - Computation of tax receipts ratio is now separately done for total
          tax and indirect tax (equation DTAXRATIO and DINDTAXRATIO).
        - Computation of DTBALR, the ratio of the trade balance to regional
          income, has been corrected (equation DTBALRATIO).
        - Computation of EV_ALT, the summary variable for EV, has been
          corrected (equation EV_DECOMPOSITION).
    Also the notation has been changed for the tax-income ratio variables:
        TGCR -> del_taxrgc,    TPCR -> del_taxrpc,    TIUR -> del_taxriu,
        TFUR -> del_taxrfu,    TOUTR -> del_taxrout,  TEXPR -> del_taxrexp,
        TIMPR -> del_taxrimp,  TINCR -> del_taxrinc,  DTAXR -> del_ttaxr.

    Version 6.0 replaces version 5.0 used in the August 2000 short course, but
    never formally released.  The subsequent changes have been quite
    significant (primarily focused on final demand and welfare decomposition),
    so we decided to give it a new version number.  This also prevents
    confusion with the soon to be released version 5.0 GTAP data set.

    The differences with the previous publicly released version of GTAP.TAB,
    Version 4.1, dated November 1998, are numerous.  One goal of this version
    is to reorganize the TAB file which had not be redesigned since its
    inception.  In addition, there is a long list of substantive changes that
    have been made between Version 4.1 and 6.0.  These include:

        - provision for multiple margins sectors (to accommodate post version
          5 GTAP data)
        - introduction of the new theory of final demand following McDougall's
          GTAP Technical Paper #20
        - modification of the welfare decomposition following McDougall's
          Technical Paper #20
        - correction to the treatment of technical change, ao, in the presence
          of ESUBT > 0 (affects equations VADEMAND and INTDEMAND)
        - addition of import-augmenting "technical change" in the Armington
          nest: ams which can be used to lower the effective price of imported
          products
        - specification of Baldwin-type capital accmulation effects following
          Francois' Technical Paper #7
        - introduction of uniform consumption tax instrument, tp(r,t)


    ----------------------------------
    Overview of the GTAP.TAB Structure
    ----------------------------------
    Preliminaries:
        FILES
        SETS
        READ statements of Base Data
        Common VARIABLES
        Common COEFFICIENTS

    Modules:
        1.  Government Consumption
        2.  Private Consumption
        3.  Firms
        4.  Investment, Global Bank, and Savings
        5.  International Trade
        6.  International Transport Services
        7.  Regional Household
        8.  Equilibrium Conditions

    Appendices:
        A.  Summary Indices
        B.  Equivalent Variation
        C.  Welfare Decomposition
        D.  Terms of Trade Decomposition
>!


!<
    -----
    FILES
    -----
>!

File
    GTAPSETS # file with set specification #;
File
    GTAPDATA # file containing all standard coefficient base data #;
File
    GTAPPARM # file containing behavioral parameters #;
File
    GTAPINT # file containing GTAP-INT intertemporal-specific coefficients #;


!<
    ----
    SETS
    ----

    Sets define relevant groupings of entities over which we will be
    performing operations in the model.  SUBSETS are defined in order to
    facilitate summation over only a portion of a given group, e.g., tradeable
    commodities.  Users with access to GEMPACK can increase the maximum set
    sizes to permit larger aggregations, provided you have sufficient RAM for
    implementing them The standard model (10x10 aggregation with decomposition
    code) is designed to run with 16 Mb of RAM.


    Aide-Memoire for Sets
    ---------------------

    |--------------------------------------|
    |         DEMD_COMM                    |
    |----------------------------------------------------|
    | ENDW_COMM |       TRAD_COMM          |  CGDS_COMM  |
    |----------------------------------------------------|
    |        NSAV_COMM                                   |
    |----------------------------------------------------|
                |                     PROD_COMM          |
                |----------------------------------------|

    For Endowments,
    |-------------------------|
    | ENDW_COMM               |
    |-------------------------|
    | ENDWM_COMM | ENDWS_COMM |
    |-------------------------|
>!



Set
    REG # regions in the model #
    maximum size 10 read elements from file GTAPSETS header "H1";
Set
    PROD_COMM # produced commodities #
    maximum size 10 read elements from file GTAPSETS header "H5";
Set
    CGDS_COMM # capital goods commodities # (cgds);
Subset
    CGDS_COMM is subset of PROD_COMM;
Set 
    TRAD_COMM # traded commodities # = PROD_COMM - CGDS_COMM;
Set
    MARG_COMM # margin commodities #
    maximum size 10 read elements from file GTAPSETS header "MARG";
Subset
    MARG_COMM is subset of TRAD_COMM;
Set
    NMRG_COMM # non-margin commodities # = TRAD_COMM - MARG_COMM;
Set
    ENDW_COMM # endowment commodities #
    maximum size 5 read elements from file GTAPSETS header "H6";
Set
    DEMD_COMM # demanded commodities # = ENDW_COMM union TRAD_COMM;
Set
    NSAV_COMM # non-savings commodities # = DEMD_COMM union CGDS_COMM;
Subset
    PROD_COMM is subset of NSAV_COMM;

!<
    Check for non-overlapping sets (users can't use the same name for elements
    of ENDW_COMM, TRAD_COMM or CGDS_COMM).
>!

Coefficient
    SIZE_TRAD # size of TRAD_COMM set #;
Formula
    SIZE_TRAD = sum(i,TRAD_COMM, 1);
Coefficient
    SIZE_ENDW # size of ENDW_COMM set #;
Formula
    SIZE_ENDW = sum(i,ENDW_COMM, 1);
Coefficient
    SIZE_DEMD # size of DEMD_COMM set #;
Formula
    SIZE_DEMD = sum(i,DEMD_COMM, 1);
Assertion (initial)
    SIZE_DEMD = SIZE_TRAD + SIZE_ENDW;

Coefficient
    SIZE_CGDS # size of CGDS_COMM set #;
Formula
    SIZE_CGDS = sum(i,CGDS_COMM, 1);
Coefficient
    SIZE_PROD # size of PROD_COMM set #;
Formula
    SIZE_PROD = sum(i,PROD_COMM, 1);
Assertion (initial)
    SIZE_PROD = SIZE_TRAD + SIZE_CGDS;

Set
    ENDWS_COMM
    # sluggish endowment commodities # (land, natlres);
Subset
    ENDWS_COMM is subset of ENDW_COMM;
Set
    ENDWM_COMM
    # mobile endowment commodities # = ENDW_COMM - ENDWS_COMM;
Set
    ENDWC_COMM # capital endowment commodity # (capital);
!<
    This single element set is defined for the sake of convenience.
>!
Subset
    ENDWC_COMM is subset of ENDW_COMM;
Set
    ENDWNC_COMM # Endowment commodities without capital # = ENDW_COMM - ENDWC_COMM;
Subset
    ENDWS_COMM is subset of ENDW_COMM;
!<
    Time
>!

Coefficient (integer)
    NTSP # Number of timesteps #;
Read
    NTSP from file GTAPINT header "NTSP";

Set (intertemporal)
    ALLTIME # All time steps # maximum size 51 (P[0] - P[NTSP-1]);

Coefficient (parameter)(all,t,ALLTIME)
    YEAR(t) # Actual years #;
Read
    YEAR from file GTAPINT header "YEAR";

Set (intertemporal)
    INITIME # Initial time step # size 1 (P[0]);

Set (intertemporal)
    ENDTIME # End time step # size 1 (P[NTSP-1]);

Set (intertemporal)
    FWDTIME # All time steps except ENDTIME # maximum size 50 (P[0] - P[NTSP-2]);

Set (intertemporal)
    FTRTIME # All time steps except INITIME # maximum size 200 (P[1]-P[NTSP-1]);

Subset INITIME is subset of ALLTIME;
Subset ENDTIME is subset of ALLTIME;
Subset FWDTIME is subset of ALLTIME;
Subset FTRTIME is subset of ALLTIME;


!<
    ----------------------------
    READ Statements of Base Data
    ----------------------------

    We read in here almost all the base data, and define variables and
    coefficients associated with them.  A few data arrays used each in a
    single module are read in those modules: VKB, VTMFSD, and DPARSUM.

    The READ statements are divided into six sections:

    Saving
    Government Consumption
    Private Consumption
    Firms
    Global Bank
    International Trade and Transport

    Since these are invariant for each solution of the model, they are termed
    coefficients.  Coefficients are assigned upper case to distinguish them
    from variables.  (This is purely cosmetic, as GEMPACK is not
    case-sensitive.) Variables in GEMPACK are assigned lower case labels to
    denote the fact that they are percentage changes.  In some cases, original
    levels values for selected variables are defined to permit the user to
    compare post-simulation levels values across several simulations.

    The updating command indicates how the new level of the coefficient will
    be computed based on the previous solution of the linearized equations.
    Note that the notation used in the update commands is a shorthand for
    total differentials of these coefficient values.  Thus, w * v indicates
    that we want to take the total differential of W * V, plug in the
    calculated values of w and v, and add this to the base level in order to
    obtain a revised value for this product.
>!


!<
    Saving
    ------
>!

Variable (all,r,REG)(all,t,ALLTIME)
    psave(r,t) # price of savings in region r #;
Variable (all,r,REG)(all,t,ALLTIME)
    qsave(r,t) # regional demand for NET savings #;
Coefficient (all,r,REG)(all,t,ALLTIME)
    SAVE(r,t) #expenditure on NET savings in region r valued at agent's prices#;
Update (all,r,REG)(all,t,ALLTIME)
    SAVE(r,t) = psave(r,t) * qsave(r,t);
Read
    SAVE from file GTAPDATA header "SAVE";


!<
    Government Consumption
    ----------------------
>!

Variable (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    pgd(i,s,t) # price of domestic i in government consumption in s #;
Variable (orig_level=VDGM)(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    qgd(i,s,t) # government hhld demand for domestic i in region s #;
Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDGA(i,r,t) # government consumption expenditure on domestic i in r #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDGA(i,r,t) = pgd(i,r,t) * qgd(i,r,t);
Read
    VDGA from file GTAPDATA header "VDGA";

Variable (orig_level=1.0)(all,i,NSAV_COMM)(all,r,REG)(all,t,ALLTIME)
    pm(i,r,t) # market price of commodity i in region r #;
Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDGM(i,r,t) # government consumption expenditure on domestic i in r #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDGM(i,r,t) = pm(i,r,t) * qgd(i,r,t);
Read
    VDGM from file GTAPDATA header "VDGM";

Variable (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    pgm(i,s,t) # price of imports of i in government consumption in s #;
Variable (orig_level=VIGM)(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    qgm(i,s,t) # government hhld demand for imports of i in region s #;
Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIGA(i,r,t) # government consumption expenditure on imported i #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIGA(i,r,t) = pgm(i,r,t) * qgm(i,r,t);
Read
    VIGA from file GTAPDATA header "VIGA";

Variable (orig_level=1.0)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    pim(i,r,t) # market price of composite import i in region r #;
Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIGM(i,r,t) # gov't consumption expenditure on i in r #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIGM(i,r,t) = pim(i,r,t) * qgm(i,r,t);
Read
    VIGM from file GTAPDATA header "VIGM";


!<
    Private Consumption
    -------------------
>!

Variable (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    ppd(i,s,t) # price of domestic i to private households in s #;
Variable (orig_level=VDPM)(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    qpd(i,s,t) # private hhld demand for domestic i in region s #;
Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDPA(i,r,t) # private consumption expenditure on domestic i in r #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDPA(i,r,t) = ppd(i,r,t) * qpd(i,r,t);
Read
    VDPA from file GTAPDATA header "VDPA";

Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDPM(i,r,t) # private consumption expenditure on domestic i in r #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDPM(i,r,t) = pm(i,r,t) * qpd(i,r,t);
Read
    VDPM from file GTAPDATA header "VDPM";

Variable (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    ppm(i,s,t) # price of imports of i by private households in s #;
Variable (orig_level=VIPM)(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    qpm(i,s,t) # private hhld demand for imports of i in region s #;
Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIPA(i,r,t) # private consumption expenditure on imported i in r #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIPA(i,r,t) = ppm(i,r,t) * qpm(i,r,t);
Read
    VIPA from file GTAPDATA header "VIPA";

Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIPM(i,r,t) # private consumption expenditure on i in r #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIPM(i,r,t)= pim(i,r,t) * qpm(i,r,t);
Read
    VIPM from file GTAPDATA header "VIPM";


!<
    Firms
    -----
>!

Variable (all,i,NSAV_COMM)(all,r,REG)(all,t,ALLTIME)
    ps(i,r,t) # supply price of commodity i in region r #;
Variable (orig_level=VOM)(all,i,NSAV_COMM)(all,r,REG)(all,t,ALLTIME)
    qo(i,r,t) # industry output of commodity i in region r #;
Coefficient (ge 0)(all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    EVOA(i,r,t) # value of commodity i output in region r #;
Update (all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    EVOA(i,r,t) = ps(i,r,t) * qo(i,r,t);
Read
    EVOA from file GTAPDATA header "EVOA";

Variable (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    pfe(i,j,r,t) # firms' price for endowment commodity i in ind. j, region r #;
Variable (orig_level=VFM)(all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    qfe(i,j,r,t)  # demand for endowment i for use in ind. j in region r #;
Coefficient (ge 0)(all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    EVFA(i,j,r,t) # producer expenditure on i by j in r at agent's prices #;
Update (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    EVFA(i,j,r,t) = pfe(i,j,r,t) * qfe(i,j,r,t);
Read
    EVFA from file GTAPDATA header "EVFA";

Variable (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,s,REG)(all,t,ALLTIME)
    pfd(i,j,s,t) # price index for domestic purchases of i by j in region s #;
Variable (orig_level=VDFM)(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,s,REG)(all,t,ALLTIME)
    qfd(i,j,s,t)  # domestic good i demanded by industry j in region s #;
Coefficient (ge 0)(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDFA(i,j,r,t) # purchases of domestic i for use by j in region r #;
Update (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDFA(i,j,r,t) = pfd(i,j,r,t) * qfd(i,j,r,t);
Read
    VDFA from file GTAPDATA header "VDFA";

Variable (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,s,REG)(all,t,ALLTIME)
    pfm(i,j,s,t) # price index for imports of i by j in region s #;
Variable (orig_level=VIFM)(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,s,REG)(all,t,ALLTIME)
    qfm(i,j,s,t) # demand for i by industry j in region s #;
Coefficient (ge 0)(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIFA(i,j,r,t) # purchases of imported i for use by j in region r #;
Update (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIFA(i,j,r,t) = pfm(i,j,r,t) * qfm(i,j,r,t);
Read
    VIFA from file GTAPDATA header "VIFA";

Variable (all,i,ENDWS_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    pmes(i,j,r,t) # market price of sluggish endowment i used by j in r #;
Coefficient (ge 0)(all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VFM(i,j,r,t) # producer expenditure on i by j in r valued at mkt prices #;
Update (all,i,ENDWM_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VFM(i,j,r,t) = pm(i,r,t) * qfe(i,j,r,t);
Update (all,i,ENDWS_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VFM(i,j,r,t) = pmes(i,j,r,t) * qfe(i,j,r,t);
Read
    VFM from file GTAPDATA header "VFM";

Coefficient (ge 0)(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIFM(i,j,r,t) # purchases of imports i for use by j in region r #;
Update (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIFM(i,j,r,t) = pim(i,r,t) * qfm(i,j,r,t);
Read
    VIFM from file GTAPDATA header "VIFM";

Coefficient (ge 0)(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDFM(i,j,r,t) # purchases of domestic i for use by j in region r #;
Update (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDFM(i,j,r,t) = pm(i,r,t) * qfd(i,j,r,t);
Read
    VDFM from file GTAPDATA header "VDFM";


!<
    Global Bank
    -----------
>!


Variable (all,r,REG)(all,t,ALLTIME)
    pcgds(r,t) # price of investment goods = ps("cgds",r,t) #;
Coefficient (ge 0)(all,r,REG)(all,t,ALLTIME)
    VDEP(r,t) # value of capital depeciation in r (exogenous,t) #;
Update (all,r,REG)(all,t,ALLTIME)
    VDEP(r,t) = qo("capital",r,t) * pcgds(r,t);
Read
    VDEP from file GTAPDATA header "VDEP";
!<
    Value of capital depreciation is used to compute the (exogenous)
    depreciation rate and therefore does not appear in update.
>!


!<
    International Trade and Transport
    ---------------------------------
>!

Variable (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    pms(i,r,s,t) # domestic price for good i supplied from r to region s #;
Variable (orig_level=VXMD)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    qxs(i,r,s,t) # export sales of commodity i from r to region s #;
Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VIMS(i,r,s,t) # imports of i from r to s valued at domestic mkt prices #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VIMS(i,r,s,t) = pms(i,r,s,t) * qxs(i,r,s,t);
Read
    VIMS from file GTAPDATA header "VIMS";

Variable (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    pcif(i,r,s,t) # CIF world price of commodity i supplied from r to s #;
Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VIWS(i,r,s,t) # imports of i from r to s valued CIF (tradeables only) #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VIWS(i,r,s,t) = pcif(i,r,s,t) * qxs(i,r,s,t);
Read
    VIWS from file GTAPDATA header "VIWS";

Variable (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    pfob(i,r,s,t) # FOB world price of commodity i supplied from r to s #;
Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VXWD(i,r,s,t) # exports of i from r to s valued FOB (tradeables only) #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VXWD(i,r,s,t) = pfob(i,r,s,t) * qxs(i,r,s,t);
Read
    VXWD from file GTAPDATA header "VXWD";

Coefficient (ge 0)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VXMD(i,r,s,t) # exports of i from r to s valued at mkt prices (tradeables only) #;
Update (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VXMD(i,r,s,t) = pm(i,r,t) * qxs(i,r,s,t);
Read
    VXMD from file GTAPDATA header "VXMD";

Variable (orig_level=VST)(all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    qst(m,r,t) # sales of m from r to international transport #;
Coefficient (ge 0)(all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    VST(m,r,t) # exprts of m from r for int'l trnsport valued at mkt p (tradeables only) #;
Update (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    VST(m,r,t) = pm(m,r,t) * qst(m,r,t);
Read
    VST from file GTAPDATA header "VST";


!<
    ----------------
    Common VARIABLES
    ----------------

    Common variables are defined as variables which are used in more than one
    module.  For example, the variable y(r,t) is used in the Goverment
    Consumption, Private Consumption, Firms, Regional Household and
    Investment, Global Bank and Savings modules.  Appendices, e.g., Summary
    Indices, are not included in this definition.
>!

Variable (all,r,REG)(all,t,ALLTIME)
    y(r,t) # regional household income in region r #;
Variable (all,r,REG)(all,t,ALLTIME)
    pop(r,t) # regional population #;
Variable (all,i,ENDWS_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    qoes(i,j,r,t) # supply of sluggish endowment i used by j in r #;
Variable (all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    endwslack(i,r,t) # slack variable in endowment market clearing condition #;
!<
    This is exogenous, unless the user wishes to employ a partial equilibrium
    closure in which the price of one or more of the primary factors is fixed.
>!

Variable (all,r,REG)(all,t,ALLTIME)
    pgov(r,t) # price index for gov't hhld expenditure in region r #;
Variable (all,r,REG)(all,t,ALLTIME)
    yg(r,t) # regional government consumption expenditure in region r #;
Variable (all,r,REG)(all,t,ALLTIME)
    ug(r,t) # per capita utility from gov't expend. in region r #;
Variable (all,r,REG)(all,t,ALLTIME)
    ppriv(r,t) # price index for private consumption expenditure in region r #;
Variable (all,r,REG)(all,t,ALLTIME)
    uepriv(r,t) # elasticity of cost wrt utility from private consumption #;
Variable (all,r,REG)(all,t,ALLTIME)
    yp(r,t) # regional private consumption expenditure in region r #;
Variable (all,r,REG)(all,t,ALLTIME)
    up(r,t) # per capita utility from private expend. in region r #;
Variable (all,i,NSAV_COMM)(all,r,REG)(all,t,ALLTIME)
    to(i,r,t) # output (or income) tax in region r #;
!<
    Note:  It is important that the user NOT shock the tax on capital goods
    output, as this will cause an inconsistency in the update relationship for
    VOM(cgds,t).
>!
Variable (orig_level=VIM)(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    qim(i,s,t) # aggregate imports of i in region s, market price weights #;
Variable (all,t,ALLTIME)
    globalcgds(t) # global supply of capital goods for NET investment #;
Variable (all,t,ALLTIME)
    pcgdswld(t) #world average price of capital goods (net investment weights,t)#;

!<
    The following variables could be dropped when converting to levels
    equation for income.  They are only needed for the linearized equation.
    The idea here is to look at the ratio of taxes to income in order to
    preserve homogeneity in prices.  (We could also look at changes in tax
    revenue, but then a uniform price increase would change this variable.)
    Obviously a simple percentage change variable doesn't work, since many
    taxes are initially zero.  The basic logic of this approach is as follows:

    Let R be the ratio of taxes to income: R = T/Y, then:
        dR = d(T/Y) = R(t - y)/100
    multiply through by Y to get:
        YdR = dT - Ty/100
    This ratio change is computed for each tax type and for total taxes.  Then
    the change in tax revenue itself may be computed as:
        dT = YdR + Ty/100
    in order to determine regional income.
>!

Variable (change)(all,r,REG)(all,t,ALLTIME)
    del_taxrgc(r,t) # change in ratio of government consumption tax to INCOME #;
Variable (change)(all,r,REG)(all,t,ALLTIME)
    del_taxrpc(r,t) # change in ratio of private consumption tax to INCOME #;
Variable (change)(all,r,REG)(all,t,ALLTIME)
    del_taxriu(r,t) # change in ratio of tax on intermediate usage to INCOME #;
Variable (change)(all,r,REG)(all,t,ALLTIME)
    del_taxrfu(r,t) # change in ratio of tax on primary factor usage to INCOME#;
Variable (change)(all,r,REG)(all,t,ALLTIME)
    del_taxrout(r,t) # change in ratio of output tax to INCOME #;
Variable (change)(all,r,REG)(all,t,ALLTIME)
    del_taxrexp(r,t) # change in ratio of export tax to INCOME #;
Variable (change)(all,r,REG)(all,t,ALLTIME)
    del_taxrimp(r,t) # change in ratio of import tax to INCOME #;
Variable (change)(all,r,REG)(all,t,ALLTIME)
    del_taxrinc(r,t) # change in ratio of income tax to INCOME #;


!<
    -------------------
    Common COEFFICIENTS
    -------------------

    Key Derivatives of the Base Data
    Regional Expenditure and Income
    Indirect Tax Receipts
    Miscellaneous Coefficients

    Common Coefficients are defined as coefficients which are used in more
    than one module.  For example, ESUBD(i) is used in the Goverment
    Household, Private Household, and Firms modules.
>!


!<
    Key Derivatives of the Base Data
    --------------------------------
>!

Coefficient (all,i,DEMD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VFA(i,j,r,t) #producer expenditure on i by j in r valued at agent's prices#;
Formula (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VFA(i,j,r,t) = EVFA(i,j,r,t);
Formula (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,s,REG)(all,t,ALLTIME)
    VFA(i,j,s,t) = VDFA(i,j,s,t) + VIFA(i,j,s,t);

Coefficient (all,i,NSAV_COMM)(all,r,REG)(all,t,ALLTIME)
    VOA(i,r,t) # value of commodity i output in region r at agent's prices #;
Formula (all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    VOA(i,r,t) = EVOA(i,r,t);
Formula (all,i,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VOA(i,r,t) = sum(j,DEMD_COMM, VFA(j,i,r,t));

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDM(i,r,t) # domestic sales of i in r at mkt prices (tradeables only) #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VDM(i,r,t) = VDPM(i,r,t) + VDGM(i,r,t) + sum(j,PROD_COMM, VDFM(i,j,r,t));

Coefficient (all,i,NSAV_COMM)(all,r,REG)(all,t,ALLTIME)
    VOM(i,r,t) # value of commodity i output in region r at market prices #;
Formula (all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    VOM(i,r,t) = sum(j,PROD_COMM, VFM(i,j,r,t));
Formula (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    VOM(m,r,t) = VDM(m,r,t) + sum(s,REG, VXMD(m,r,s,t)) + VST(m,r,t);
Formula (all,i,NMRG_COMM)(all,r,REG)(all,t,ALLTIME)
    VOM(i,r,t) = VDM(i,r,t) + sum(s,REG, VXMD(i,r,s,t));
Formula (all,h,CGDS_COMM)(all,r,REG)(all,t,ALLTIME)
    VOM(h,r,t) = VOA(h,r,t);


!<
    Regional Expenditure and Income
    -------------------------------

    Regional income is allocated between private consumption expenditure,
    government consumption expenditure, and saving.


    Expenditure of Regional Household
    .................................

               Regional household(h.h.)
                Expenditure = Income
                         _/|\_
                       _/  |  \_
                     _/    |    \_
                   _/      |      \_
                 _/        |        \_
       Private h.h.        |        Government h.h.
       ( PRIVEXP )         |          ( GOVEXP )
          _/\_             |              _/\_
        _/    \_           |            _/    \_
       /        \          |           /        \
    Domestic  Imported   Savings    Domestic    Imported
     Goods     Goods     ( SAVE )    Goods       Goods
    ( VDPA )  ( VIPA )              ( VDGA )    ( VIGA )

    Note: The coefficients at the ends of branches are
          Base Data, e.g., VDPA, SAVE.
>!

! government consumption expenditure, GOVEXP !
Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VGA(i,r,t) # government consn expenditure on i in r at agent's prices #;
Formula (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    VGA(i,s,t) = VDGA(i,s,t) + VIGA(i,s,t);
Coefficient (all,r,REG)(all,t,ALLTIME)
    GOVEXP(r,t) # government expenditure in region r #;
Formula (all,r,REG)(all,t,ALLTIME)
    GOVEXP(r,t) = sum(i,TRAD_COMM, VGA(i,r,t));

! private consumption expenditure, PRIVEXP !
Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VPA(i,r,t) # private hhld expenditure on i in r valued at agent's prices #;
Formula (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    VPA(i,s,t) = VDPA(i,s,t) + VIPA(i,s,t);
Coefficient (all,r,REG)(all,t,ALLTIME)
    PRIVEXP(r,t) # private consumption expenditure in region r #;
Formula (all,r,REG)(all,t,ALLTIME)
    PRIVEXP(r,t) = sum(i,TRAD_COMM, VPA(i,r,t));

! aggregate expenditure + saving = aggregate income !
Coefficient (all,r,REG)(all,t,ALLTIME)
    INCOME(r,t) # level of expenditure, which equals NET income in region r #;
Formula (all,r,REG)(all,t,ALLTIME)
    INCOME(r,t) = PRIVEXP(r,t) + GOVEXP(r,t) + SAVE(r,t);


!<
    Indirect Tax Receipts
    ---------------------
>!

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    DGTAX(i,r,t) #tax on government consumption of domestic good i in region r#;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    DGTAX(i,r,t) = VDGA(i,r,t) - VDGM(i,r,t);
Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    IGTAX(i,r,t) #tax on government consumption of imported good i in region r#;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    IGTAX(i,r,t) = VIGA(i,r,t) - VIGM(i,r,t);
Coefficient (all,r,REG)(all,t,ALLTIME)
    TGC(r,t) # government consumption tax payments in r #;
Formula (all,r,REG)(all,t,ALLTIME)
    TGC(r,t) = sum(i,TRAD_COMM, DGTAX(i,r,t) + IGTAX(i,r,t));

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    DPTAX(i,r,t) # tax on private consumption of domestic good i in region r #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    DPTAX(i,r,t) = VDPA(i,r,t) - VDPM(i,r,t);
Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    IPTAX(i,r,t) # tax on private consumption of imported good i in region r #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    IPTAX(i,r,t) = VIPA(i,r,t) - VIPM(i,r,t);
Coefficient (all,r,REG)(all,t,ALLTIME)
    TPC(r,t) # private consumption tax payments in r #;
Formula (all,r,REG)(all,t,ALLTIME)
    TPC(r,t) = sum(i,TRAD_COMM, DPTAX(i,r,t) + IPTAX(i,r,t));

Coefficient (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    DFTAX(i,j,r,t) # tax on use of domestic intermediate good i by j in r #;
Formula (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    DFTAX(i,j,r,t) = VDFA(i,j,r,t) - VDFM(i,j,r,t);
Coefficient (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    IFTAX(i,j,r,t) # tax on use of imported intermediate good i by j in r #;
Formula (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    IFTAX(i,j,r,t) = VIFA(i,j,r,t) - VIFM(i,j,r,t);
Coefficient (all,r,REG)(all,t,ALLTIME)
    TIU(r,t) # firms' tax payments on intermediate goods usage in r #;
Formula (all,r,REG)(all,t,ALLTIME)
    TIU(r,t) =
       sum(i,TRAD_COMM, sum(j,PROD_COMM, DFTAX(i,j,r,t) + IFTAX(i,j,r,t)));

Coefficient (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    ETAX(i,j,r,t) # tax on use of endowment good i by industry j in region r #;
Formula (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    ETAX(i,j,r,t) = VFA(i,j,r,t) - VFM(i,j,r,t);
Coefficient (all,r,REG)(all,t,ALLTIME)
    TFU(r,t) # firms' tax payments on primary factor usage in r #;
Formula (all,r,REG)(all,t,ALLTIME)
    TFU(r,t) = sum(i,ENDW_COMM, sum(j,PROD_COMM, ETAX(i,j,r,t)));

Coefficient (all,i,NSAV_COMM)(all,r,REG)(all,t,ALLTIME)
    PTAX(i,r,t) # output tax on good i in region r #;
Formula (all,i,NSAV_COMM)(all,r,REG)(all,t,ALLTIME)
    PTAX(i,r,t) = VOM(i,r,t) - VOA(i,r,t);
Coefficient (all,r,REG)(all,t,ALLTIME)
    TOUT(r,t) # production tax payments in r #;
Formula (all,r,REG)(all,t,ALLTIME)
    TOUT(r,t) = sum(i,PROD_COMM, PTAX(i,r,t));

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    XTAXD(i,r,s,t) # tax on exports of good i from source r to destination s #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    XTAXD(i,r,s,t) = VXWD(i,r,s,t) - VXMD(i,r,s,t);
Coefficient (all,r,REG)(all,t,ALLTIME)
    TEX(r,t) # export tax payments in r #;
Formula (all,r,REG)(all,t,ALLTIME)
    TEX(r,t) = sum(i,TRAD_COMM, sum(s,REG, XTAXD(i,r,s,t)));

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    MTAX(i,r,s,t) # tax on imports of good i from source r in destination s #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    MTAX(i,r,s,t) = VIMS(i,r,s,t) - VIWS(i,r,s,t);
Coefficient (all,r,REG)(all,t,ALLTIME)
    TIM(r,t) # import tax payments in r #;
Formula (all,r,REG)(all,t,ALLTIME)
    TIM(r,t) = sum(i,TRAD_COMM, sum(s,REG, MTAX(i,s,r,t)));


!<
    Miscellaneous Coefficients
    --------------------------
>!

! domestic/imported substitution elasticity !
Coefficient (parameter)(all,i,TRAD_COMM)(all,t,ALLTIME)
    ESUBD(i,t) # region-generic el. of sub. domestic/imported for all agents #;
Read
    ESUBD from file GTAPPARM header "ESBD";

! net global investment expenditure !
Coefficient (all,r,REG)(all,t,ALLTIME)
    REGINV(r,t) # regional GROSS investment in r (value of 'cgds' output) #;
Formula (all,r,REG)(all,t,ALLTIME)
    REGINV(r,t) = sum(k,CGDS_COMM, VOA(k,r,t));
Coefficient (all,r,REG)(all,t,ALLTIME)
    NETINV(r,t) # regional NET investment in region r #;
Formula (all,r,REG)(all,t,ALLTIME)
    NETINV(r,t) = sum(k,CGDS_COMM, VOA(k,r,t)) - VDEP(r,t);
Coefficient (all,t,ALLTIME)
    GLOBINV(t) # global expenditures on net investment #;
Formula (all,t,ALLTIME)
    GLOBINV(t) = sum(r,REG, NETINV(r,t));

! elasticity of cost wrt utility from private consumption !
Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CONSHR(i,r,t) # share of private hhld consumption devoted to good i in r #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CONSHR(i,r,t) = VPA(i,r,t) / sum(k,TRAD_COMM, VPA(k,r,t));
Coefficient (parameter)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    INCPAR(i,r,t) # expansion parameter in the CDE minimum expenditure function #;
Read
    INCPAR from file GTAPPARM header "INCP";
Coefficient (all,r,REG)(all,t,ALLTIME)
    UELASPRIV(r,t) # elasticity of cost wrt utility from private consumption #;
Formula (all,r,REG)(all,t,ALLTIME)
    UELASPRIV(r,t) = sum(i,TRAD_COMM, CONSHR(i,r,t) * INCPAR(i,r,t));


!<
    =======
    Modules
    =======

    1. Government Consumption
    2. Private Consumption
    3. Firms
    4. Investment, Global Bank, and Savings
    5. International Trade
    6. International Transport Services
    7. Regional Household
    8. Equilibrium Conditions
>!


!<
    -------------------------
    1. Government Consumption
    -------------------------

    1-0. Module-Specific Variables
    1-1. Demands for Composite Goods
    1-2. Composite Tradeables
>!


!<
    1-0. Module-Specific Variables
    ------------------------------

    only used in this Government Consumption module
>!

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    pg(i,r,t) # government consumption price for commodity i in region r #;
Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    qg(i,r,t) # government hhld demand for commodity i in region r #;


!<
    1-1. Demands for Composite Goods
    --------------------------------
>!

Equation GPRICEINDEX
# definition of price index for aggregate gov't purchases (HT 40) #
(all,r,REG)(all,t,ALLTIME)
    pgov(r,t) = sum(i,TRAD_COMM, [VGA(i,r,t) / GOVEXP(r,t)] * pg(i,r,t));

Equation GOVDMNDS
# government consumption demands for composite commodities (HT 41) #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    qg(i,r,t) - pop(r,t) = ug(r,t) - [pg(i,r,t) - pgov(r,t)];

Equation GOVU
# utility from government consumption in r #
(all,r,REG)(all,t,ALLTIME)
    yg(r,t) - pop(r,t) = pgov(r,t) + ug(r,t);


!<
    1-2. Composite Tradeables
    -------------------------
>!

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    tgd(i,r,t) # tax on domestic i purchased by government hhld in r #;

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    tgm(i,r,t) # tax on imported i purchased by gov't hhld in r #;

Equation GHHDPRICE
# eq'n links domestic market and government consumption prices (HT 19) #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    pgd(i,r,t) = tgd(i,r,t) + pm(i,r,t);

Equation GHHIPRICES
# eq'n links domestic market and government consumption prices (HT 22) #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    pgm(i,r,t) = tgm(i,r,t) + pim(i,r,t);

Coefficient (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    GMSHR(i,s,t) # share of imports for gov't hhld at agent's prices #;
Formula (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    GMSHR(i,s,t) = VIGA(i,s,t) / VGA(i,s,t);

Equation GCOMPRICE
# government consumption price for composite commodities (HT 42) #
(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    pg(i,s,t) =  GMSHR(i,s,t) * pgm(i,s,t) + [1 - GMSHR(i,s,t)] * pgd(i,s,t);

Equation GHHLDAGRIMP
# government consumption demand for aggregate imports (HT 43) #
(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    qgm(i,s,t) = qg(i,s,t) + ESUBD(i,t) * [pg(i,s,t) - pgm(i,s,t)];

Equation GHHLDDOM
# government consumption demand for domestic goods (HT 44) #
(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    qgd(i,s,t) = qg(i,s,t) + ESUBD(i,t) * [pg(i,s,t) - pgd(i,s,t)];

Equation TGCRATIO
# change in ratio of government consumption tax payments to regional income #
(all,r,REG)(all,t,ALLTIME)
    100.0 * INCOME(r,t) * del_taxrgc(r,t) + TGC(r,t) * y(r,t)
        = sum(i,TRAD_COMM,
            VDGA(i,r,t) * tgd(i,r,t) + DGTAX(i,r,t) * [pm(i,r,t) + qgd(i,r,t)])
        + sum(i,TRAD_COMM,
            VIGA(i,r,t)* tgm(i,r,t) + IGTAX(i,r,t) * [pim(i,r,t) + qgm(i,r,t)]);


!<
    -----------------------------
    2. Private Consumption Module
    -----------------------------

    2-0. Module-Specific Variables
    2-1. Utility from Private Consumption
    2-2. Allen Partials, Price and Income Elasticities, Composite Demand
    2-3. Composite Tradeables
>!


!<
    2-0. Module-Specific Variables
    ------------------------------

    only used in this Private Consumption module
>!

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    pp(i,r,t) # private consumption price for commodity i in region r #;
Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    qp(i,r,t) # private hhld demand for commodity i in region r #;
Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    qptaste(i,r,t) # private hhld demand shift for commodity i in region r #;


!<
    2-1. Utility from Private Consumption
    -------------------------------------
>!

Equation PHHLDINDEX
# price index for private consumption expenditure #
(all,r,REG)(all,t,ALLTIME)
    ppriv(r,t) = sum(i,TRAD_COMM, CONSHR(i,r,t) * pp(i,r,t));

Equation PRIVATEU
# computation of utility from private consumption in r (HT 45) #
(all,r,REG)(all,t,ALLTIME)
    yp(r,t) - pop(r,t) = ppriv(r,t) + UELASPRIV(r,t) * up(r,t);
!<
    This equation determines private consumption utility for a representative
    household in region r, based on the per capita private expenditure
    function.  (HT 45)
>!

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    XWCONSHR(i,r,t) # expansion-parameter-weighted consumption share #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    XWCONSHR(i,r,t) = CONSHR(i,r,t) * INCPAR(i,r,t) / UELASPRIV(r,t);

Equation UTILELASPRIV
# elasticity of expenditure wrt utility from private consumption #
(all,r,REG)(all,t,ALLTIME)
    uepriv(r,t)
        = sum(i,TRAD_COMM, XWCONSHR(i,r,t) * [pp(i,r,t) + qp(i,r,t) - yp(r,t)]);


!<
    2-2. Allen Partials, Price and Income Elasticities, Composite Demand
    --------------------------------------------------------------------
>!

Coefficient (parameter)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SUBPAR(i,r,t) # substitution parameter in CDE minimum expenditure function #;
Read
    SUBPAR from file GTAPPARM header "SUBP";

!<
    (HT F1 - F3)
>!
Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    ALPHA(i,r,t) # 1 - sub. parameter in the CDE minimum expenditure function #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    ALPHA(i,r,t) = 1 - SUBPAR(i,r,t);

Coefficient (all,i,TRAD_COMM)(all,k,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    APE(i,k,r,t) # Allen partial elst. of sub. between composite i and k in r #;
Formula (all,i,TRAD_COMM)(all,k,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    APE(i,k,r,t) = ALPHA(i,r,t) + ALPHA(k,r,t)
                   - sum(n,TRAD_COMM, CONSHR(n,r,t) * ALPHA(n,r,t));
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    APE(i,i,r,t)
        = 2.0 * ALPHA(i,r,t)
        - sum(n,TRAD_COMM, CONSHR(n,r,t) * ALPHA(n,r,t))
        - ALPHA(i,r,t) / CONSHR(i,r,t);

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    EY(i,r,t) # income elast. of private hhld demand for i in r (HT F4) #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    EY(i,r,t)
        =   [1.0 / sum(n,TRAD_COMM, CONSHR(n,r,t) * INCPAR(n,r,t))]
            * [INCPAR(i,r,t) * [1.0 - ALPHA(i,r,t)]
               + sum(n,TRAD_COMM, CONSHR(n,r,t) * INCPAR(n,r,t) * ALPHA(n,r,t))]
        + [ALPHA(i,r,t) - sum(n,TRAD_COMM, CONSHR(n,r,t) * ALPHA(n,r,t))];

Coefficient (all,i,TRAD_COMM)(all,k,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    EP(i,k,r,t) # uncomp. elast. of private hhld demand for i wrt price of k in r (HT F5) #;
Formula (all,i,TRAD_COMM)(all,k,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    EP(i,k,r,t) = 0;
Formula (all,i,TRAD_COMM)(all,k,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    EP(i,k,r,t) = [APE(i,k,r,t) - EY(i,r,t)] * CONSHR(k,r,t);

Equation PRIVDMNDS
# private consumption demands for composite commodities (HT 46) #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    qp(i,r,t) - pop(r,t) - qptaste(i,r,t)
        = sum(k,TRAD_COMM, EP(i,k,r,t) * pp(k,r,t))
          + EY(i,r,t) * [yp(r,t) - pop(r,t)];
!<
    Private consumption demands for composite commodities.  Demand system is
    on a per capita basis.  Here, yp(r,t) - pop(r,t) is % change in per capita
    income.  (HT 46)
>!


!<
    2-3. Composite Tradeables
    -------------------------
>!

Variable (all,r,REG)(all,t,ALLTIME)
    tp(r,t) # comm.-, source-gen. shift in tax on private cons. #;
!<
  The variable tp(r,t) can be swapped with del_ttaxr(r,t) in order to generate a
  tax replacement scenario, whereby taxes remain a constant share of
  national income.
>!

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    tpd(i,r,t) # comm.-, source-spec. shift in tax on private cons. of dom. #;
Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    atpd(i,r,t) # power of tax on domestic i purchased by private hhld in r #;
Equation TPDSHIFT
# permits uniform consumption tax change #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    atpd(i,r,t) = tpd(i,r,t) + tp(r,t);

Equation PHHDPRICE
# eq'n links domestic market and private consumption prices (HT 18) #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    ppd(i,r,t) = atpd(i,r,t) + pm(i,r,t);

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    tpm(i,r,t) # comm.-, source-spec. shift in tax on private cons. of imp. #;
Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    atpm(i,r,t) # power of tax on imported i purchased by private hhld in r #;
Equation TPMSHIFT
# permits uniform consumption tax change #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    atpm(i,r,t) = tpm(i,r,t) + tp(r,t);

Equation PHHIPRICES
# eq'n links domestic market and private consumption prices (HT 21) #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    ppm(i,r,t) = atpm(i,r,t) + pim(i,r,t);

Equation TPCRATIO
# change in ratio of private consumption tax payments to regional income #
(all,r,REG)(all,t,ALLTIME)
    100.0 * INCOME(r,t) * del_taxrpc(r,t) + TPC(r,t) * y(r,t)
        = sum(i,TRAD_COMM,
            VDPA(i,r,t) * atpd(i,r,t) + DPTAX(i,r,t) * [pm(i,r,t) + qpd(i,r,t)])
        + sum(i,TRAD_COMM,
            VIPA(i,r,t)* atpm(i,r,t) + IPTAX(i,r,t)* [pim(i,r,t) + qpm(i,r,t)]);

Coefficient (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    PMSHR(i,s,t) # share of imports for priv hhld at agent's prices #;
Formula (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    PMSHR(i,s,t) = VIPA(i,s,t) / VPA(i,s,t);

Equation PCOMPRICE
# private consumption price for composite commodities (HT 47) #
(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    pp(i,s,t) = PMSHR(i,s,t) * ppm(i,s,t) + [1 - PMSHR(i,s,t)] * ppd(i,s,t);

Equation PHHLDDOM
# private consumption demand for domestic goods (HT 48) #
(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    qpd(i,s,t) = qp(i,s,t) + ESUBD(i,t) * [pp(i,s,t) - ppd(i,s,t)];

Equation PHHLDAGRIMP
# private consumption demand for aggregate imports (HT 49) #
(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    qpm(i,s,t) = qp(i,s,t) + ESUBD(i,t) * [pp(i,s,t) - ppm(i,s,t)];


!<
    ---------
    3. Firms
    ---------

    We now turn to the behavioral equations for firms.  The following picture
    describes factor demands.  The first set of equations describe demands for
    primary factors.  (See table 4 of Hertel and Tsigas.)

    Production structure
    --------------------

                             qo(j,r,t)  [ao(j,r,t)]
                             /\
                            /  \  <----- CES
                           /    \
                          /      \
                         /        \
      [ava(j,r,t)]  qva(j,r,t)        qf(i,j,r,t)  [af(i,j,r,t)]
                  /|\                    /\
 CES ----->      / | \                  /  \  <------ CES
                /  |  \                /    \
               /   |   \              /      \
              /    |    \            /        \
          Land   Labor  Capital  Domestic     Foreign
               qfe(i,j,r,t)         qfd(i,j,r,t)  qfm(i,j,r,t)
             [afe(i,j,r,t)]



    3-0. Module-Specific Variables
    3-1. Total Output Nest
    3-2. Composite Intermediates Nest
    3-3. Value-Added Nest
    3-4. Zero Profits Equations
>!


!<
    3-0. Module-Specific Variables
    ------------------------------

    only used in this Firms module or the Summary Indices or Welfare
    appendices
>!

Variable (all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    pva(j,r,t) # firms' price of value added in industry j of region r #;
Variable (all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    qva(j,r,t) # value added in industry j of region r #;
Variable (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    pf(i,j,r,t) # firms' price for commodity i for use by j in r #;
Variable (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    qf(i,j,r,t) # demand for commodity i for use by j in region r #;
Variable (all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    ao(j,r,t) # output augmenting technical change in sector j of r #;
Variable (all,i,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    ava(i,r,t) # value added augmenting tech change in sector i of r #;
Variable (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    af(i,j,r,t) #composite intermed. input i augmenting tech change by j of r #;
Variable (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    afe(i,j,r,t) # primary factor i augmenting tech change by j of r #;
Variable (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    ams(i,r,s,t) # import i from region r augmenting tech change in region s #;


!<
    3-1. Total Output Nest
    ----------------------
>!

Variable (all,j,PROD_COMM)(all,t,ALLTIME)
    aosec(j,t) # output tech change of sector j, worldwide #;
Variable (all,r,REG)(all,t,ALLTIME)
    aoreg(r,t) # output tech change in region r #;
Variable (all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    aoall(j,r,t) # output augmenting technical change in sector j of r #;
Equation AOWORLD
# sector/region specific average rate of output augmenting tech change #
(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    ao(j,r,t) = aosec(j,t) + aoreg(r,t) + aoall(j,r,t);

Variable (all,j,PROD_COMM)(all,t,ALLTIME)
    avasec(j,t) # value added tech change of sector j, worldwide #;
Variable (all,r,REG)(all,t,ALLTIME)
    avareg(r,t) # value added tech change in region r #;
Variable (all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    avaall(j,r,t) # value added augmenting technical change in sector j of r #;
Equation AVAWORLD
# sector/region specific average rate of value added augmenting tech change #
(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    ava(j,r,t) = avasec(j,t) + avareg(r,t) + avaall(j,r,t);

Coefficient (parameter)(all,j,PROD_COMM)(all,t,ALLTIME)
    ESUBT(j,t) # elst. of sub. among composite intermediate inputs in production #;
Read
    ESUBT from file GTAPPARM header "ESBT";

Equation VADEMAND
# sector demands for primary factor composite #
(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    qva(j,r,t)
        = -ava(j,r,t) + qo(j,r,t) - ao(j,r,t)
        - ESUBT(j,t) * [pva(j,r,t) - ava(j,r,t) - ps(j,r,t) - ao(j,r,t)];
!<
    Sector demands for primary factor composite.  This equation differs from
    HT 35 due to the presence of intermediate input substitution.
>!

Variable (all,i,TRAD_COMM)(all,t,ALLTIME)
    afcom(i,t) # intermediate tech change of input i, worldwide #;
Variable (all,j,PROD_COMM)(all,t,ALLTIME)
    afsec(j,t) # intermediate tech change of sector j, worldwide #;
Variable (all,r,REG)(all,t,ALLTIME)
    afreg(r,t) # intermediate tech change in region r #;
Variable (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    afall(i,j,r,t) # intermediate input i augmenting tech change by j in r #;
Equation AFWORLD
# sector/region specific average rate of intermediates augmenting tech change #
(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    af(i,j,r,t) = afcom(i,t) + afsec(j,t) + afreg(r,t) + afall(i,j,r,t);

Equation INTDEMAND
# industry demands for intermediate inputs, including cgds #
(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    qf(i,j,r,t)
        = - af(i,j,r,t) + qo(j,r,t) - ao(j,r,t)
        - ESUBT(j,t) * [pf(i,j,r,t) - af(i,j,r,t) - ps(j,r,t) - ao(j,r,t)];
!<
    Industry demands for intermediate inputs, including cgds.  This equation
    differs from HT 36 due to the presence of intermediate input substitution.
>!


!<
    3-2. Composite Intermediates Nest
    ---------------------------------
>!

Variable (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    tfd(i,j,r,t) # tax on domestic i purchased by j in r #;
Equation DMNDDPRICE
# eq'n links domestic market and firm prices (HT 20) #
(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    pfd(i,j,r,t) = tfd(i,j,r,t) + pm(i,r,t);
!<
    This equation links domestic market and firm prices.  It holds only for
    domestic goods and it captures the effect of commodity taxation of firms.
    (HT 20)
>!

Variable (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    tfm(i,j,r,t) # tax on imported i purchased by j in r #;
Equation DMNDIPRICES
# eq'n links domestic market and firm prices (HT 23) #
(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    pfm(i,j,r,t) = tfm(i,j,r,t) + pim(i,r,t);
!<
    This equation links domestic market and firm prices.  It holds only for
    imported goods and it captures the effect of commodity taxation of firms.
    (HT 23)
>!

Equation TIURATIO
# change in ratio of tax payments on intermediate goods to regional income #
(all,r,REG)(all,t,ALLTIME)
    100.0 * INCOME(r,t) * del_taxriu(r,t) + TIU(r,t) * y(r,t)
        = sum(i,TRAD_COMM, sum(j,PROD_COMM,
            VDFA(i,j,r,t) * tfd(i,j,r,t)
             + DFTAX(i,j,r,t) * [pm(i,r,t) + qfd(i,j,r,t)]))
        + sum(i,TRAD_COMM, sum(j,PROD_COMM,VIFA(i,j,r,t) * tfm(i,j,r,t)
             + IFTAX(i,j,r,t) * [pim(i,r,t) + qfm(i,j,r,t)]));

Zerodivide (zero_by_zero) default 0;
Coefficient (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,s,REG)(all,t,ALLTIME)
    FMSHR(i,j,s,t) # share of firms' imports in dom. composite, agent's prices#;
Formula (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,s,REG)(all,t,ALLTIME)
    FMSHR(i,j,s,t) = VIFA(i,j,s,t) / VFA(i,j,s,t);
Zerodivide (zero_by_zero) off;
Equation ICOMPRICE
# industry price for composite commodities (HT 30) #
(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    pf(i,j,r,t) = FMSHR(i,j,r,t) * pfm(i,j,r,t)
                   + [1 - FMSHR(i,j,r,t)] * pfd(i,j,r,t);

Equation INDIMP
# industry j demands for composite import i (HT 31) #
(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,s,REG)(all,t,ALLTIME)
    qfm(i,j,s,t) = qf(i,j,s,t) - ESUBD(i,t) * [pfm(i,j,s,t) - pf(i,j,s,t)];

Equation INDDOM
# industry j demands for domestic good i (HT 32) #
(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,s,REG)(all,t,ALLTIME)
    qfd(i,j,s,t) = qf(i,j,s,t) - ESUBD(i,t) * [pfd(i,j,s,t) - pf(i,j,s,t)];


!<
    3-3. Value-Added Nest
    ---------------------
>!

Variable (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    tf(i,j,r,t) # tax on primary factor i used by j in region r #;

Equation MPFACTPRICE
# eq'n links domestic and firm demand prices (HT 16) #
(all,i,ENDWM_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    pfe(i,j,r,t) = tf(i,j,r,t) + pm(i,r,t);

Equation SPFACTPRICE
# eq'n links domestic and firm demand prices (HT 17) #
(all,i,ENDWS_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    pfe(i,j,r,t) = tf(i,j,r,t) + pmes(i,j,r,t);

Variable (all,i,ENDW_COMM)(all,t,ALLTIME)
    afecom(i,t) # factor input tech change of input i, worldwide #;
Variable (all,j,PROD_COMM)(all,t,ALLTIME)
    afesec(j,t) # factor input tech change of sector j, worldwide #;
Variable (all,r,REG)(all,t,ALLTIME)
    afereg(r,t) # factor input tech change in region r #;
Variable (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    afeall(i,j,r,t) # primary factor i augmenting tech change sector j in r #;
Equation AFEWORLD
# sector/region specific average rate of prim. factor i augmenting tech change #
(all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    afe(i,j,r,t) = afecom(i,t) + afesec(j,t) + afereg(r,t) + afeall(i,j,r,t);

Coefficient (all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VVA(j,r,t) # value added in activity j in region r #;
Formula (all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    VVA(j,r,t) = sum(i,ENDW_COMM, VFA(i,j,r,t));
Coefficient (all,i,ENDW_COMM)(all,t,ALLTIME)
    SVADEFAULT(i,t) #zerodivide default for SVA#;
Formula (all,i,ENDW_COMM)(all,t,ALLTIME)
    SVADEFAULT(i,t)
        = sum(j,PROD_COMM, sum(r,REG, VFA(i,j,r,t)))
        / sum(j,PROD_COMM, sum(r,REG, VVA(j,r,t)));
Coefficient (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    SVA(i,j,r,t) # share of i in total value added in j in r #;
Formula (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,t,ALLTIME)
(all,r,REG: VVA(j,r,t) <> 0)
    SVA(i,j,r,t) = VFA(i,j,r,t) / VVA(j,r,t);
Formula (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,t,ALLTIME)
(all,r,REG: VVA(j,r,t) = 0)
    SVA(i,j,r,t) = SVADEFAULT(i,t);
Equation VAPRICE
# effective price of primary factor composite in each sector/region (HT 33) #
(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    pva(j,r,t) = sum(k,ENDW_COMM, SVA(k,j,r,t) * [pfe(k,j,r,t) - afe(k,j,r,t)]);

Equation TFURATIO
# change in ratio of tax payments on factor usage to regional income #
(all,r,REG)(all,t,ALLTIME)
    100.0 * INCOME(r,t) * del_taxrfu(r,t) + TFU(r,t) * y(r,t)
        = sum(i,ENDWM_COMM, sum(j,PROD_COMM,VFA(i,j,r,t) * tf(i,j,r,t)
               + ETAX(i,j,r,t) * [pm(i,r,t) + qfe(i,j,r,t)]))
        + sum(i,ENDWS_COMM, sum(j,PROD_COMM,VFA(i,j,r,t) * tf(i,j,r,t)
               + ETAX(i,j,r,t) * [pmes(i,j,r,t) + qfe(i,j,r,t)]));

Coefficient (parameter)(all,j,PROD_COMM)(all,t,ALLTIME)
    ESUBVA(j,t) # elst. of sub. capital/labor/land, in production of value added in j #;
Read
    ESUBVA from file GTAPPARM header "ESBV";

Equation ENDWDEMAND
# demands for endowment commodities (HT 34) #
(all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    qfe(i,j,r,t)
        = - afe(i,j,r,t) + qva(j,r,t)
        - ESUBVA(j,t) * [pfe(i,j,r,t) - afe(i,j,r,t) - pva(j,r,t)];


!<
    3-4. Zero Profits Equations
    ---------------------------
>!

Equation OUTPUTPRICES
# eq'n links pre- and post-tax supply prices for all industries  (HT 15) #
(all,i,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    ps(i,r,t) = to(i,r,t) + pm(i,r,t);
!<
    This equation links pre- and post-tax supply prices for all industries.
    This captures the effect of output taxes.  TO(i,r,t) < 1 in the case of a
    tax.  (HT 15)
>!

Equation TOUTRATIO
# change in ratio of output tax payments to regional income #
(all,r,REG)(all,t,ALLTIME)
    100.0 * INCOME(r,t) * del_taxrout(r,t) + TOUT(r,t) * y(r,t)
        = sum(i,PROD_COMM,
            VOA(i,r,t) * [-to(i,r,t)] + PTAX(i,r,t) * [pm(i,r,t) + qo(i,r,t)]);

Variable (all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    profitslack(j,r,t) # slack variable in the zero profit equation #;
!<
    This is exogenous, unless the user wishes to specify output in a given
    region exogenously.
>!
Coefficient (all,i,DEMD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    STC(i,j,r,t) # share of i in total costs of j in r #;
Formula (all,i,DEMD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    STC(i,j,r,t) = VFA(i,j,r,t) / sum(k,DEMD_COMM, VFA(k,j,r,t));

Equation ZEROPROFITS
# industry zero pure profits condition (HT 6) #
(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    ps(j,r,t) + ao(j,r,t)
        = sum(i,ENDW_COMM,
                STC(i,j,r,t) * [pfe(i,j,r,t) - afe(i,j,r,t) - ava(j,r,t)])
        + sum(i,TRAD_COMM, STC(i,j,r,t) * [pf(i,j,r,t)  - af(i,j,r,t)])
        + profitslack(j,r,t);
!<
    Industry zero pure profits condition (HT 6).  This condition permits us to
    determine the endogenous output level for each of the non-endowment
    sectors, excepting when profitslack is itself endogenous.  The level of
    activity in the endowment sectors is exogenously determined.
>!


!<
    ---------------------------------------
    4. Investment, Global Bank, and Savings
    ---------------------------------------

    Capital stock and rate of return equations follow.  They correspond to the
    Investment Equations of Table 8 in Hertel and Tsigas.

    4-0. Module-Specific Variables
    4-1. Equations of Notational Convenience
    4-2. Rate of Return Equations
    4-3. Capital Accumulation
    4-4. Global Bank
    4-5. Price Index of Aggregate Global Composite Capital Goods
    4-6. Price of Saving
>!


!<
    4-0. Module-Specific Variables
    ------------------------------

    only used in this Investment, Global Bank and Savings module
>!

!Variable (all,r,REG)(all,t,ALLTIME)
    rental(r,t) # rental rate on capital = ps("capital",r,t) #;!
!Variable (all,r,REG)(all,t,ALLTIME)
    ke(r,t) # end-of-period capital stock in r #;!
!Variable (all,r,REG)(all,t,ALLTIME)
    rore(r,t) # expected net rate of return on capital stock in r #;!
!Variable (all,r,REG)(all,t,ALLTIME)
    rorc(r,t) # current net rate of return on capital stock in r #;!
Variable (all,r,REG)(all,t,ALLTIME)
    qcgds(r,t) # output of capital goods sector = qo("cgds",r,t) #;


!<
    4-1. Equations of Notational Convenience
    ----------------------------------------
>!

!Variable (all,r,REG)(all,t,ALLTIME)
    ksvces(r,t) # capital services = qo("capital",r,t) #;
Equation KAPSVCES
# eq'n defines a variable for capital services (HT 52) #
(all,r,REG)(all,t,ALLTIME)
    ksvces(r,t)
        = sum(h,ENDWC_COMM, [VOA(h,r,t)
            / sum(k,ENDWC_COMM, VOA(k,r,t))] * qo(h,r,t));!
!<
    This equation defines a variable for capital services, for convenience.
    (There is really only one capital services item.)(HT 52)
>!

!Equation KAPRENTAL
# eq'n defines a variable for capital rental rate (HT 53) #
(all,r,REG)(all,t,ALLTIME)
    rental(r,t)
        = sum(h,ENDWC_COMM, [VOA(h,r,t)
                     / sum(k,ENDWC_COMM, VOA(k,r,t))] * ps(h,r,t));!

Equation CAPGOODS
# eq'n defines a variable for gross investment (HT 54) #
(all,r,REG)(all,t,ALLTIME)
    qcgds(r,t)
        = sum(h,CGDS_COMM, [VOA(h,r,t) / REGINV(r,t)] * qo(h,r,t));
!<
    This equation defines a variable for gross investment, for convenience.
    There is really only one capital goods item.
>!

Equation PRCGOODS
# eq'n defines the price of cgds (HT 55) #
(all,r,REG)(all,t,ALLTIME)
    pcgds(r,t) = sum(h,CGDS_COMM, [VOA(h,r,t) / REGINV(r,t)] * ps(h,r,t));

!Equation KBEGINNING
# associates change in cap. services w/ change in cap. stock (HT 56) #
(all,r,REG)(all,t,ALLTIME)
    kb(r,t) = ksvces(r,t);!
!<
    This equation associates any change in capital services during the period
    with a change in capital stock.  Full capacity utilization is assumed.
>!

Coefficient (ge 0)(all,r,REG)(all,t,ALLTIME)
    VKB(r,t) # value of beginning-of-period capital stock in region r #;
Read
    VKB from file GTAPDATA header "VKB";
!<qo("capital",r,t)
  VKB(r,t) is used only in this sub-module, so its data are read here.  The
  associated variables, pcgds(r,t) and kb(r,t), are used across modules, so they
  have been defined as common variables.
>!

!Coefficient (all,r,REG)(all,t,ALLTIME)
    INVKERATIO(r,t) # ratio of gross investment to end-of-period capital stock in r #;
Formula (all,r,REG)(all,t,ALLTIME)
    INVKERATIO(r,t) = REGINV(r,t) / [VKB(r,t) + NETINV(r,t)];!

!Equation KEND
# Ending capital stock equals beginning stock plus net investment.  (HT 10) #
(all,r,REG)(all,t,ALLTIME)
    ke(r,t) = INVKERATIO(r,t) * qcgds(r,t) + [1.0 - INVKERATIO(r,t)] * kb(r,t);!


!<
    4-2. Rate of Return Equations
    -----------------------------
>!

!Coefficient (all,r,REG)(all,t,ALLTIME)
    GRNETRATIO(r,t) # ratio of GROSS/NET rates of return on capital in r #;
Formula (all,r,REG)(all,t,ALLTIME)
    GRNETRATIO(r,t)
        = sum(h,ENDWC_COMM, VOA(h,r,t))
        / [sum(h,ENDWC_COMM, VOA(h,r,t)) - VDEP(r,t)];!
!<
    NOTE: VOA("capital",r,t) is GROSS returns to capital.
>!
!Equation RORCURRENT
# current rate of return on capital in region r (HT 57) #
(all,r,REG)(all,t,ALLTIME)
    rorc(r,t) = GRNETRATIO(r,t) * [rental(r,t) - pcgds(r,t)];!

!Coefficient (parameter)(all,r,REG)(all,t,ALLTIME)
    RORFLEX(r,t) # flexibility of expected net ROR on capital stock in r wrt investment #;
Read
    RORFLEX from file GTAPPARM header "RFLX";!
!<
    RORFLEX is the flexibility of the expected net rate of return on the
    capital stock, in region r, with respect to investment.  If a region's
    capital stock increases by 1%, then it is expected that the net rate of
    return on capital will decline by RORFLEX %.  A larger absolute value for
    this parameter will reduce the tendency of international investment flows
    to respond to changes in expected rates of return.
>!

!Equation ROREXPECTED
# expected rate of return depends on the current return and investment (HT 58) #
(all,r,REG)(all,t,ALLTIME)
    rore(r,t) = rorc(r,t) - RORFLEX(r,t) * [ke(r,t) - kb(r,t)];!


!<
    4-3. Capital Accumulation
    -------------------------

    based on the theory laid out in GTAP Technical Paper #7
>!

!Variable (all,i,ENDWC_COMM)(all,r,REG)(all,t,ALLTIME)
    EXPAND(i,r,t) # change in investment levels relative to endowment stock #;
Equation BALDWIN
# change in investment levels relative to endowment stock #
(all,i,ENDWC_COMM)(all,r,REG)(all,t,ALLTIME)
    EXPAND(i,r,t) = qcgds(r,t) - qo(i,r,t);!


!<
    4-4. Global Bank
    ----------------
>!

!Coefficient (integer,parameter)(all,t,ALLTIME)
    RORDELTA(t) # binary coefficient to switch mechanism of allocating investment funds #;
Read
    RORDELTA from file GTAPPARM header "RDLT";!
!<
    RORDELTA is a binary coefficient which determines the mechanism of
    allocating investment funds across regions.  When RORDELTA = 1, investment
    funds are allocated across regions to equate the change in the expected
    rates of return (i.e., rore(r,t)).  When RORDELTA = 0, investment funds are
    allocated across regions to maintain the existing composition of capital
    stocks.
>!

Variable (all,t,ALLTIME)
    rorg(t) # global net rate of return on capital stock #;
!Variable (all,r,REG)(all,t,ALLTIME)
    cgdslack(r,t) # slack variable for qcgds(r,t) #;!
!<
    This is exogenous, unless the user wishes to exogenously fix the level of
    gross investment in a region, in which case it can be swapped with
    cgdslack.
>!
!Equation RORGLOBAL
# either gross investment or expected rate of return in region r (HT 59) #
(all,r,REG)(all,t,ALLTIME)
    RORDELTA(t) * rore(r,t)
    + [1 - RORDELTA(t)]
    * [[REGINV(r,t) / NETINV(r,t)] * qcgds(r,t)
          - [VDEP(r,t) / NETINV(r,t)] * qo("capital",r,t)]
        = RORDELTA(t) * rorg(t) + [1 - RORDELTA(t)] * globalcgds(t)
          + cgdslack(r,t);!
!<qo("capital",r,t)
    This equation determines either gross investment or the expected rate of
    return in each region, depending on the setting for the binary RORDELTA
    parameter.
>!

!Equation GLOBALINV
# either expected global rate of return or global net investment (HT 11) #
(all,t,ALLTIME)
    RORDELTA(t) * globalcgds(t) + [1 - RORDELTA(t)] * rorg(t)
        = RORDELTA(t)
        * sum(r,REG,
            [REGINV(r,t) / GLOBINV(t)] * qcgds(r,t)
               - [VDEP(r,t) / GLOBINV(t)] * qo("capital",r,t))
        + [1-RORDELTA(t)] * sum(r,REG, [NETINV(r,t) / GLOBINV(t)] * rore(r,t));!
!<qo("capital",r,t)
    This equation computes either the change in global net investment (when
    RORDELTA = 1), or the change in the expected global rate of return on
    capital (when RORDELTA = 0).
>!

!Equation RORGLOBAL
# either gross investment or expected rate of return in region r (HT 59) #
(all,r,REG)(all,t,ALLTIME)
    [REGINV(r,t) / NETINV(r,t)] * qcgds(r,t)
        - [VDEP(r,t) / NETINV(r,t)] * qo("capital",r,t)
        = globalcgds(t);!
! + cgdslack(r,t);!

!Equation GLOBALINV
# either expected global rate of return or global net investment (HT 11) #
(all,t,ALLTIME)
    rorg(t)
        = sum(r,REG, [NETINV(r,t) / GLOBINV(t)] * rore(r,t));!

Equation GLOBALINV
# either expected global rate of return or global net investment (HT 11) #
(all,t,ALLTIME)
    globalcgds(t)
        = sum(r,REG,
            [REGINV(r,t) / GLOBINV(t)] * qcgds(r,t)
              - [VDEP(r,t) / GLOBINV(t)] * qo("capital",r,t));

!<
    4-5. Price Index of Aggregate Global Composite Capital Goods
    ------------------------------------------------------------
>!

Equation PRICGDS
# eq'n generates a price index for the aggregate global cgds composite (HT 60) #
(all,t,ALLTIME)
    pcgdswld(t) = sum(r,REG, [NETINV(r,t) / GLOBINV(t)] * pcgds(r,t));


!<
    4-6. Price of Saving
    --------------------
>!

Variable (all,r,REG)(all,t,ALLTIME)
    psaveslack(r,t) # slack variable for the savings price equation #;
!<
    This is exogenous under the normal closure.  However, in order to
    replicate simulations from the GTAP book, where there was a single savings
    price, psaveslack may be swapped with psave in order to fix the latter.
    In this case, pcgdswld must be the numeraire so that each region faces the
    same price of savings.
>!

Equation SAVEPRICE
# savings price #
(all,r,REG)(all,t,ALLTIME)
    psave(r,t)
        = pcgds(r,t)
        + sum(s,REG, [[NETINV(s,t) - SAVE(s,t)] / GLOBINV(t)] * pcgds(s,t))
        + psaveslack(r,t);
!<
    In contrast to the GTAP book, the price of savings is now region-specific
    and it changes at the same rate as the price of regional investment, plus
    an adjustment factor which accounts for the fact that savings and
    investment are not equal at the regional level.
>!


!<
    ----------------------
    5. International Trade
    ----------------------

    5-1. Export Prices
    5-2. Demand for Imports
>!


!<
    5-1. Export Prices
    ------------------
>!

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    tx(i,r,t) # dest.-gen. change in subsidy on exports of i from r #;
Variable (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    txs(i,r,s,t) # dest.-spec. change in subsidy on exports of i from r to s #;
!<
    The variable txs captures changes in the power of bilateral export taxes.
    However, the presence of a destination-generic export subsidy shift (tx)
    also permits the user to swap a single export tax shock with another
    target variable.  It is most naturally swapped with the variable qo to
    insulate domestic producers from the world market.
>!

Equation EXPRICES
# eq'n links agent's and world prices (HT 27) #
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    pfob(i,r,s,t) = pm(i,r,t) - tx(i,r,t) - txs(i,r,s,t);

Equation TEXPRATIO
# change in ratio of export tax payments to regional income #
(all,r,REG)(all,t,ALLTIME)
    100.0 * INCOME(r,t) * del_taxrexp(r,t) + TEX(r,t) * y(r,t)
        = sum(i,TRAD_COMM, sum(s,REG,
            VXMD(i,r,s,t) * [-tx(i,r,t) - txs(i,r,s,t)]
            + XTAXD(i,r,s,t) * [pfob(i,r,s,t) + qxs(i,r,s,t)]));


!<
    5-2. Demand for Imports
    -----------------------

    Composite Imports Nest: Table 3 of Hertel and Tsigas
>!

Variable (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    tm(i,s,t) # source-gen. change in tax on imports of i into s #;
Variable (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    tms(i,r,s,t) # source-spec. change in tax on imports of i from r into s #;
!<
    The variable tms captures changes in the power of bilateral import taxes.
    However, the presence of a source-generic import tariff shift (tm) also
    permits the user to swap a single import tariff shock with another target
    variable.  In particular, to insulate domestic producers from import price
    changes, it may be swapped with the relative price variable pr -- see
    below.
>!

Equation MKTPRICES
# eq'n links domestic and world prices (HT 24) #
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    pms(i,r,s,t) = tm(i,s,t) + tms(i,r,s,t) + pcif(i,r,s,t);

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    MSHRS(i,r,s,t) # share of imports from r in import bill of s at mkt prices#;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    MSHRS(i,r,s,t) = VIMS(i,r,s,t) / sum(k,REG, VIMS(i,k,s,t));
Equation DPRICEIMP
# price for aggregate imports (HT 28) #
(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    pim(i,s,t) = sum(k,REG, MSHRS(i,k,s,t) * [pms(i,k,s,t) - ams(i,k,s,t)]);

Variable (orig_level=1.0)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    pr(i,r,t) # ratio of domestic to imported prices in r #;
Equation PRICETGT
# eq'n defines target price ratio to be attained via the variable levy (HT 25) #
(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    pr(i,s,t) = pm(i,s,t) - pim(i,s,t);
!<
    This equation defines the target price ratio to be attained via the
    variable levy.  This price ratio is the ratio of domestic to average
    imported goods' price.  Note that the way this price ratio is defined, it
    includes intraregional imports as well.  In most applications, regions
    will represent groups of individual countries.  However, in the case of
    the EU, this is problematic, since recent versions of the database have
    incorporated intra-EU trade flows.  Therefore, when aggregated to the EU
    level, the composite import price includes both intra-EU and outside
    imports.  So some modification is needed to handle the EU case.
>!

Coefficient (parameter)(all,i,TRAD_COMM)(all,t,ALLTIME)
    ESUBM(i,t) # region-generic el. of sub. among imports of i in Armington structure #;
Read
    ESUBM from file GTAPPARM header "ESBM";

Equation IMPORTDEMAND
# regional demand for disaggregated imported commodities by source (HT 29)  #
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    qxs(i,r,s,t)
        = -ams(i,r,s,t) + qim(i,s,t)
        - ESUBM(i,t) * [pms(i,r,s,t) - ams(i,r,s,t) - pim(i,s,t)];

Equation TIMPRATIO
# change in ratio of import tax payments to regional income #
(all,r,REG)(all,t,ALLTIME)
    100.0 * INCOME(r,t) * del_taxrimp(r,t) + TIM(r,t) * y(r,t)
        = sum(i,TRAD_COMM, sum(s,REG,
            VIMS(i,s,r,t) * [tm(i,r,t) + tms(i,s,r,t)]
            + MTAX(i,s,r,t) * [pcif(i,s,r,t) + qxs(i,s,r,t)]));


!<
    -----------------------------------
    6. International Transport Services
    -----------------------------------

    6-0. Module-Specific Variables and Coefficients
    6-1. Demand for Global Transport Services
    6-2. Supply of Transport Services
>!


!<
    6-0. Module-Specific Variables and Coefficients
    -----------------------------------------------

    only used in this International Transport Services module
>!

Variable (all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    qtmfsd(m,i,r,s,t) # international usage margin m on i from r to s #;
!<
    International margin usage, by Margin, Freight, Source, and Destination,
    i.e., the percent change in usage of m in transport of i from r to s.
>!
Variable (all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    atmfsd(m,i,r,s,t) # tech change in m's shipping of i from region r to s #;
!<
    Technical progress in shipping by Margin, Freight, Source, and
    Destination.  This is endogenous and driven by the following mode-,
    product-, source-, and destination-specific determinants.
>!
Variable (all,m,TRAD_COMM)(all,t,ALLTIME)
    atm(m,t) # tech change in mode m, worldwide #;
Variable (all,i,TRAD_COMM)(all,t,ALLTIME)
    atf(i,t) # tech change shipping of i, worldwide #;
Variable (all,r,REG)(all,t,ALLTIME)
    ats(r,t) # tech change shipping from region r #;
Variable (all,s,REG)(all,t,ALLTIME)
    atd(s,t) # tech change shipping to s #;
Variable (all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    atall(m,i,r,s,t) # tech change in m's shipping of i from region r to s #;
Variable (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    ptrans(i,r,s,t) # cost index for international transport of i from r to s #;
!<
    average cost index for margin services used in getting i from r to s
>!
Variable (all,m,MARG_COMM)(all,t,ALLTIME)
    qtm(m,t) # global margin usage #;
Variable (all,m,MARG_COMM)(all,t,ALLTIME)
    pt(m,t) # price of composite margins services, type #;
!<
    price index for commodity m in margin services usage
>!

Coefficient (ge 0)(all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VTMFSD(m,i,r,s,t) # int'l margin usage, by margin, freight, source, and destination #;
Update (all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VTMFSD(m,i,r,s,t) = pt(m,t) * qtmfsd(m,i,r,s,t);
Read
    VTMFSD from file GTAPDATA header "VTWR";

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VTFSD(i,r,s,t) # aggregate value of svces in the shipment of i from r to s#;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VTFSD(i,r,s,t) = sum(m,MARG_COMM, VTMFSD(m,i,r,s,t));
!<
    In a balanced data base, (all,i,TRAD_COMM)(all,r,REG)(all,s,REG),
    VIWS(i,r,s,t) = VXWD(i,r,s,t) + VTFSD(i,r,s,t).
>!

Coefficient (all,m,MARG_COMM)(all,t,ALLTIME)
    VTMUSE(m,t) # international margin services usage, by type #;
Formula (all,m,MARG_COMM)(all,t,ALLTIME)
    VTMUSE(m,t) = sum(i,TRAD_COMM, sum(r,REG, sum(s,REG, VTMFSD(m,i,r,s,t))));

Coefficient (all,m,MARG_COMM)(all,t,ALLTIME)
    VTMPROV(m,t) # international margin services provision #;
Formula (all,m,MARG_COMM)(all,t,ALLTIME)
    VTMPROV(m,t) = sum(r,REG, VST(m,r,t));
!<
    In a balanced data base, VTMPROV = VTMUSE.
>!

Coefficient (all,r,REG)(all,t,ALLTIME)
    VTRPROV(r,t) # international margin supply, by region #;
Formula (all,r,REG)(all,t,ALLTIME)
    VTRPROV(r,t) = sum(m,MARG_COMM, VST(m,r,t));

Coefficient (all,t,ALLTIME)
    VT(t) # international margin supply #;
Formula (all,t,ALLTIME)
    VT(t) = sum(m,MARG_COMM, sum(r,REG, VST(m,r,t)));


!<
    6-1. Demand for Global Transport Services
    -----------------------------------------
>!

Equation QTRANS_MFSD
# bilateral demand for transport services  #
(all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    qtmfsd(m,i,r,s,t) = qxs(i,r,s,t) - atmfsd(m,i,r,s,t);
!<
    This equation computes the bilateral demand for international
    transportation services.  It reflects the fact that the demand for
    services along any particular route is proportional to the quantity of
    merchandise shipped [i.e., QXS(i,r,s,t)].  It is here that we introduce the
    potential for input-augmenting tech change, atmfsd(m,i,r,s,t), which is
    commodity- and route-specific.  Thus, in the levels:
            ATMFSD(m,i,r,s,t) * QTMFSD(m,i,r,s,t) = QXS(i,r,s,t)
    where QTMFSD is the amount of composite margins services m used along this
    route.  Technological improvements are reflected by atmfsd(i,r,s,t) > 0, and
    these reduce the margins services required for this i,r,s triplet.  Tech.
    change also dampens the cost of shipping, thereby lowering the CIF price
    implied by a given FOB value (see 6-2).
>!

Coefficient (all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VTMUSESHR(m,i,r,s,t) # share of i,r,s usage in global demand for m #;
Formula (all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VTMUSESHR(m,i,r,s,t) = VTFSD(i,r,s,t) / VT(t);
Formula
    (all,t,ALLTIME)(all,m,MARG_COMM: VTMUSE(m,t) <> 0.0)(all,i,TRAD_COMM)
    (all,r,REG)(all,s,REG)
    VTMUSESHR(m,i,r,s,t) = VTMFSD(m,i,r,s,t) / VTMUSE(m,t);

Equation TRANS_DEMAND
# global demand for margin m #
(all,m,MARG_COMM)(all,t,ALLTIME)
    qtm(m,t)
        = sum(i,TRAD_COMM, sum(r,REG, sum(s,REG,
          VTMUSESHR(m,i,r,s,t) * qtmfsd(m,i,r,s,t))));


!<
    6-2. Supply of Transport Services
    ---------------------------------
>!

Coefficient (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    VTSUPPSHR(m,r,t) # share of region r in global supply of margin m #;
Formula (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    VTSUPPSHR(m,r,t) = VTRPROV(r,t) / VT(t);
Formula (all,t,ALLTIME)(all,m,MARG_COMM: VTMPROV(m,t) <> 0.0)(all,r,REG)
    VTSUPPSHR(m,r,t) = VST(m,r,t) / VTMPROV(m,t);

Equation PTRANSPORT
# generate price index for composite transportation services #
(all,m,MARG_COMM)(all,t,ALLTIME)
    pt(m,t) = sum(r,REG, VTSUPPSHR(m,r,t) * pm(m,r,t));
!<
    This equation generates a price index for transportation services based on
    zero profits.  NOTE:
    (1) Sales to international transportation are not subject to export tax.
        This is why we base the costs to the transport sector on market prices
        of the goods sold to international transportation.
    (2) We assume that the supply shares for margin services are uniform
        across freight, source of freight, and destination.
    (cf. HT#7)
>!

Coefficient (all,t,ALLTIME)
    VTUSE(t) # international margin services usage #;
Formula (all,t,ALLTIME)
    VTUSE(t)
        = sum(m,MARG_COMM, sum(i,TRAD_COMM, sum(r,REG, sum(s,REG,
            VTMFSD(m,i,r,s,t)))));

Coefficient (all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VTFSD_MSH(m,i,r,s,t) # share of margin m in cost of getting i from r to s #;
Formula (all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
        (all,s,REG: VTFSD(i,r,s,t) > 0.0)
    VTFSD_MSH(m,i,r,s,t) = VTMFSD(m,i,r,s,t) / VTFSD(i,r,s,t);
Formula (all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
        (all,s,REG: VTFSD(i,r,s,t) = 0.0)
    VTFSD_MSH(m,i,r,s,t) = VTMUSE(m,t) / VTUSE(t);

Equation TRANSCOSTINDEX
#  generates flow-specific modal average cost of transport index (cf. HT7) #
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    ptrans(i,r,s,t)
        = sum(m,MARG_COMM,VTFSD_MSH(m,i,r,s,t) * [pt(m,t) - atmfsd(m,i,r,s,t)]);

Equation TRANSTECHANGE
#  generates flow-specific average rate of technical change #
(all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    atmfsd(m,i,r,s,t) = atm(m,t) + atf(i,t) + ats(r,t)
                         + atd(s,t) + atall(m,i,r,s,t);

Equation TRANSVCES
# generate demand for regional supply of global transportation service (HT 61) #
(all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    qst(m,r,t) = qtm(m,t) + [pt(m,t) - pm(m,r,t)];
!<
    This equation generates the international transport sector's derived
    demand for regional supplies of transportation services.  It reflects a
    unitary elasticity of substitution between transportation services inputs
    from different regions.
>!

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VIWSCOST(i,r,s,t) # value of imports calculated as total cost of imports #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    VIWSCOST(i,r,s,t) = VXWD(i,r,s,t) + VTFSD(i,r,s,t);

Zerodivide (zero_by_zero) default 0;
Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    FOBSHR(i,r,s,t) # FOB share in VIW #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    FOBSHR(i,r,s,t) = VXWD(i,r,s,t) / VIWSCOST(i,r,s,t);

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    TRNSHR(i,r,s,t) # transport share in VIW #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    TRNSHR(i,r,s,t) = VTFSD(i,r,s,t) / VIWSCOST(i,r,s,t);
Zerodivide (zero_by_zero) off;

Equation FOBCIF
# eq'n links FOB and CIF prices for good i shipped from region r to s (HT 26') #
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    pcif(i,r,s,t)
       = FOBSHR(i,r,s,t) * pfob(i,r,s,t)
       + TRNSHR(i,r,s,t) * ptrans(i,r,s,t);
!<
    This equation links export and import prices for each commodity/route
    triplet.  Note that technical change is embodied in ptrans(i,r,s,t) which is
    now a cost index, as opposed to (HT 26') where it represented the price of
    margins services.
>!


!<
    ---------------------
    7. Regional Household
    ---------------------

    7-0. Module-Specific Coefficients
    7-1. Supply of Endowments by the Regional Household
    7-2. Computation of Regional Income
    7-3. Regional Household Demand System
    7-4. Aggregate Utility
>!


!<
    7-0. Module-Specific Coefficients
    ---------------------------------

    only used in this Regional Household module
>!

Coefficient (all,r,REG)(all,t,ALLTIME)
    XSHRPRIV(r,t) # private expenditure share in regional income #;
Formula (all,r,REG)(all,t,ALLTIME)
    XSHRPRIV(r,t) = PRIVEXP(r,t) / INCOME(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    XSHRGOV(r,t) # government expenditure share in regional income #;
Formula (all,r,REG)(all,t,ALLTIME)
    XSHRGOV(r,t) = GOVEXP(r,t) / INCOME(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    XSHRSAVE(r,t) # saving share in regional income #;
Formula (all,r,REG)(all,t,ALLTIME)
    XSHRSAVE(r,t) = SAVE(r,t) / INCOME(r,t);

Variable (all,r,REG)(all,t,ALLTIME)
    uelas(r,t) # elasticity of cost of utility wrt utility #;
Variable (all,r,REG)(all,t,ALLTIME)
    dppriv(r,t) # private consumption distribution parameter #;
Variable (all,r,REG)(all,t,ALLTIME)
    dpgov(r,t) # government consumption distribution parameter #;
Variable (all,r,REG)(all,t,ALLTIME)
    dpsave(r,t) # saving distribution parameter #;


!<
    7-1. Supply of Endowments by the Regional Household
    ---------------------------------------------------
>!

Equation FACTORINCPRICES
# eq'n links pre- and post-tax endowment supply prices (HT 15) #
(all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    ps(i,r,t) = to(i,r,t) + pm(i,r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    TINC(r,t) # income tax payments in r #;
Formula (all,r,REG)(all,t,ALLTIME)
    TINC(r,t) = sum(i,ENDW_COMM, PTAX(i,r,t));

Equation TINCRATIO
# change in ratio of income tax payments to regional income #
(all,r,REG)(all,t,ALLTIME)
    100.0 * INCOME(r,t) * del_taxrinc(r,t) + TINC(r,t) * y(r,t)
        = sum(i,ENDW_COMM,
            VOA(i,r,t) * [-to(i,r,t)] + PTAX(i,r,t) * [pm(i,r,t) + qo(i,r,t)]);

Coefficient (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    REVSHR(i,j,r,t) # share of endowment commodity i used by fiorms in sector j of regin r evaluated at market prices #;
Formula (all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    REVSHR(i,j,r,t) = VFM(i,j,r,t) / sum(k,PROD_COMM, VFM(i,k,r,t));
Equation ENDW_PRICE
# eq'n generates the composite price for sluggish endowments (HT 50) #
(all,i,ENDWS_COMM)(all,r,REG)(all,t,ALLTIME)
    pm(i,r,t) = sum(k,PROD_COMM, REVSHR(i,k,r,t) * pmes(i,k,r,t));

Coefficient (parameter)(all,i,ENDWS_COMM)(all,t,ALLTIME)
    ETRAE(i,t) # elst. of transformation for sluggish primary factor endowments #;
Read
    ETRAE from file GTAPPARM header "ETRE";
!<
    ETRAE is the elasticity of transformation for sluggish primary factor
    endowments.  It is non-positive, by definition.
>!
Equation ENDW_SUPPLY
# eq'n distributes the sluggish endowments across sectors (HT 51) #
(all,i,ENDWS_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    qoes(i,j,r,t) = qo(i,r,t) - endwslack(i,r,t)
                    + ETRAE(i,t) * [pm(i,r,t) - pmes(i,j,r,t)];


!<
    7-2. Computation of Regional Income
    -----------------------------------
>!

Coefficient (all,r,REG)(all,t,ALLTIME)
    FY(r,t) # primary factor income in r net of depreciation #;
Formula (all,r,REG)(all,t,ALLTIME)
    FY(r,t) = sum(i,ENDW_COMM, VOM(i,r,t)) - VDEP(r,t);
Variable (all,r,REG)(all,t,ALLTIME)
    fincome(r,t) # factor income at market prices net of depreciation #;
Equation FACTORINCOME
# factor income at market prices net of depreciation #
(all,r,REG)(all,t,ALLTIME)
    FY(r,t) * fincome(r,t)
        = sum(i,ENDW_COMM, VOM(i,r,t) * [pm(i,r,t) + qo(i,r,t)])
        - VDEP(r,t)  * [pcgds(r,t) + qo("capital",r,t)];

Variable (change)(all,r,REG)(all,t,ALLTIME)
    del_indtaxr(r,t) # change in ratio of indirect taxes to INCOME in r #;
Equation DINDTAXRATIO
# change in ratio of indirect taxes to INCOME in r #
(all,r,REG)(all,t,ALLTIME)
    del_indtaxr(r,t)
        = del_taxrpc(r,t) + del_taxrgc(r,t) + del_taxriu(r,t) + del_taxrfu(r,t)
        + del_taxrout(r,t) + del_taxrexp(r,t) + del_taxrimp(r,t);

Variable (change)(all,r,REG)(all,t,ALLTIME)
    del_ttaxr(r,t) # change in ratio of taxes to INCOME in r #;
Equation DTAXRATIO
# change in ratio of taxes to INCOME in r #
(all,r,REG)(all,t,ALLTIME)
    del_ttaxr(r,t)
        = del_taxrpc(r,t) + del_taxrgc(r,t) + del_taxriu(r,t) + del_taxrfu(r,t)
        + del_taxrout(r,t) + del_taxrexp(r,t) + del_taxrimp(r,t)
        + del_taxrinc(r,t);
!<
   This variable can be swapped with the commodity- and source-generic
   consumption tax shift, tp(r,t), in order to generate a tax replacement
   scenario, whereby taxes remain a constant share of national income.
>!

Variable (all,r,REG)(all,t,ALLTIME)
    incomeslack(r,t) # slack variable in the expression for regional income #;
!<
    This is exogenous, unless the user wishes to fix regional income.
>!

Coefficient (all,r,REG)(all,t,ALLTIME)
    INDTAX(r,t) # indirect tax receipts in r #;
Formula (all,r,REG)(all,t,ALLTIME)
    INDTAX(r,t) = TPC(r,t) + TGC(r,t) + TIU(r,t) + TFU(r,t) + TOUT(r,t)
                  + TEX(r,t) + TIM(r,t);

Equation REGIONALINCOME
# regional income = sum of primary factor income and indirect tax receipts #
(all,r,REG)(all,t,ALLTIME)
    INCOME(r,t) * y(r,t)
        = FY(r,t) * fincome(r,t)
        + 100.0 * INCOME(r,t) * del_indtaxr(r,t)
        + INDTAX(r,t) * y(r,t)
        + INCOME(r,t) * incomeslack(r,t);
!<
    This equation computes regional income as the sum of primary factor
    payment and indirect tax receipts.  The first term computes the change in
    endowment income, net of depreciation.  The subsequent terms compute the
    change in indirect tax receipts for various transactions taxes.
>!


!<
    7-3. Regional Household Demand System
    -------------------------------------
>!

Variable (all,r,REG)(all,t,ALLTIME)
    dpav(r,t) # average distribution parameter shift, for EV calc. #;
Equation DPARAV
# average distribution parameter shift #
(all,r,REG)(all,t,ALLTIME)
    dpav(r,t)
        = XSHRPRIV(r,t) * dppriv(r,t)
        + XSHRGOV(r,t) * dpgov(r,t)
        + XSHRSAVE(r,t) * dpsave(r,t);

Equation UTILITELASTIC
# elasticity of cost of utility wrt utility #
(all,r,REG)(all,t,ALLTIME)
    uelas(r,t) = XSHRPRIV(r,t) * uepriv(r,t) - dpav(r,t);

Equation PRIVCONSEXP
# private consumption expenditure #
(all,r,REG)(all,t,ALLTIME)
    yp(r,t) - y(r,t) = -[uepriv(r,t) - uelas(r,t)] + dppriv(r,t);

Equation GOVCONSEXP
# government consumption expenditure #
(all,r,REG)(all,t,ALLTIME)
    yg(r,t) - y(r,t) = uelas(r,t) + dpgov(r,t);

Equation SAVING
# saving #
(all,r,REG)(all,t,ALLTIME)
    psave(r,t) + qsave(r,t) - y(r,t) = uelas(r,t) + dpsave(r,t);


!<
    7-4. Aggregate Utility
    ----------------------
>!

Variable (all,r,REG)(all,t,ALLTIME)
    p(r,t) # price index for disposition of income by regional household #;
Equation PRICEINDEXREG
    # price index for disposition of income by regional household #
    (all,r,REG)(all,t,ALLTIME)
    p(r,t)
        = XSHRPRIV(r,t) * ppriv(r,t)
        + XSHRGOV(r,t) * pgov(r,t)
        + XSHRSAVE(r,t) * psave(r,t);

Variable (all,r,REG)(all,t,ALLTIME)
    au(r,t) # input-neutral shift in utility function #;
Variable (all,r,REG)(all,t,ALLTIME)
    dpsum(r,t) # sum of the distribution parameters #;

Coefficient (all,r,REG)(all,t,ALLTIME)
    DPARSUM(r,t) # sum of distribution parameters #;
Read
    DPARSUM from file GTAPDATA header "DPSM";
Update (all,r,REG)(all,t,ALLTIME)
    DPARSUM(r,t) = dpsum(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    UTILELAS(r,t) # elasticity of cost of utility wrt utility #;
Formula (all,r,REG)(all,t,ALLTIME)
    UTILELAS(r,t)
        = [UELASPRIV(r,t) * XSHRPRIV(r,t) + XSHRGOV(r,t)
            + XSHRSAVE(r,t)] / DPARSUM(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    DPARPRIV(r,t) # private consumption distribution parameter #;
Formula (all,r,REG)(all,t,ALLTIME)
    DPARPRIV(r,t) = UELASPRIV(r,t) * XSHRPRIV(r,t) / UTILELAS(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    DPARGOV(r,t) # government consumption distribution parameter #;
Formula (all,r,REG)(all,t,ALLTIME)
    DPARGOV(r,t) = XSHRGOV(r,t) / UTILELAS(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    DPARSAVE(r,t) # saving distribution parameter #;
Formula (all,r,REG)(all,t,ALLTIME)
    DPARSAVE(r,t) = XSHRSAVE(r,t) / UTILELAS(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    UTILPRIV(r,t) # utility from private consumption #;
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    UTILPRIV(r,t) = 1.0;
Update (all,r,REG)(all,t,ALLTIME)
    UTILPRIV(r,t) = up(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    UTILGOV(r,t) # utility from government consumption #;
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    UTILGOV(r,t) = 1.0;
Update (all,r,REG)(all,t,ALLTIME)
    UTILGOV(r,t) = ug(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    UTILSAVE(r,t) # utility from saving #;
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    UTILSAVE(r,t) = 1.0;
Update (change)(all,r,REG)(all,t,ALLTIME)
    UTILSAVE(r,t) = [[qsave(r,t) - pop(r,t)] / 100] * UTILSAVE(r,t);

Variable (all,r,REG)(all,t,ALLTIME)
    u(r,t) # per capita utility from aggregate hhld expend. in region r #;
Equation UTILITY
# regional household utility #
(all,r,REG)(all,t,ALLTIME)
    u(r,t)
        = au(r,t)
        + DPARPRIV(r,t) * loge(UTILPRIV(r,t)) * dppriv(r,t)
        + DPARGOV(r,t) * loge(UTILGOV(r,t)) * dpgov(r,t)
        + DPARSAVE(r,t) * loge(UTILSAVE(r,t)) * dpsave(r,t)
        + [1.0 / UTILELAS(r,t)] * [y(r,t) - pop(r,t) - p(r,t)];

Equation DISTPARSUM
# sum of the distribution parameters #
(all,r,REG)(all,t,ALLTIME)
    DPARSUM(r,t) * dpsum(r,t)
        = DPARPRIV(r,t) * dppriv(r,t)
        + DPARGOV(r,t) * dpgov(r,t)
        + DPARSAVE(r,t) * dpsave(r,t);


!<
    -------------------------
    8. Equilibrium Conditions
    -------------------------

    8-1. Market Clearing Conditions
    8-2. Walras' Law
>!


!<
    8-1. Market Clearing Conditions
    -------------------------------
>!

Coefficient (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRDFM(i,j,r,t) #share of dom. prod. i used by sector j in r at mkt prices#;
Formula (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRDFM(i,j,r,t) = VDFM(i,j,r,t) / VDM(i,r,t);

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRDPM(i,r,t) # share of domestic prod. of i used by private hhlds in r #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRDPM(i,r,t) = VDPM(i,r,t) / VDM(i,r,t);

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRDGM(i,r,t) # share of imports of i used by gov't hhlds in r #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRDGM(i,r,t) = VDGM(i,r,t) / VDM(i,r,t);

Variable (orig_level=VDM)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    qds(i,r,t) # domestic sales of commodity i in r #;
Equation MKTCLDOM
# eq'n assures market clearing for domestic sales (HT 3) #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    qds(i,r,t)
        = sum(j,PROD_COMM, SHRDFM(i,j,r,t) * qfd(i,j,r,t))
        + SHRDPM(i,r,t) * qpd(i,r,t)
        + SHRDGM(i,r,t) * qgd(i,r,t);

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRDM(i,r,t) # share of domestic sales of i in r #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRDM(i,r,t) = VDM(i,r,t) / VOM(i,r,t);

Coefficient (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRST(m,r,t) # share of sales of m to global transport services in r #;
Formula (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRST(m,r,t) = VST(m,r,t) / VOM(m,r,t);

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    SHRXMD(i,r,s,t) # share of export sales of i to s in r #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    SHRXMD(i,r,s,t) = VXMD(i,r,s,t) / VOM(i,r,t);

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    tradslack(i,r,t) # slack variable in tradeables market clearing condition #;
!<
    This is exogenous unless the user wishes to specify the price of
    tradeables exogenously, in which case the analysis becomes partial
    equilibrium and walraslack must be exogenized.
>!

Equation MKTCLTRD_MARG
# eq'n assures market clearing for margins commodities (HT 1) #
(all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    qo(m,r,t)
        = SHRDM(m,r,t) * qds(m,r,t)
        + SHRST(m,r,t) * qst(m,r,t)
        + sum(s,REG, SHRXMD(m,r,s,t) * qxs(m,r,s,t))
        + tradslack(m,r,t);
Equation MKTCLTRD_NMRG
# eq'n assures market clearing for the non-margins commodities (HT 1) #
(all,i,NMRG_COMM)(all,r,REG)(all,t,ALLTIME)
    qo(i,r,t)
        = SHRDM(i,r,t) * qds(i,r,t)
        + sum(s,REG, SHRXMD(i,r,s,t) * qxs(i,r,s,t))
        + tradslack(i,r,t);

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIM(i,r,t) #value of imports of commodity i in r at domestic market prices#;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VIM(i,r,t) = sum(j,PROD_COMM, VIFM(i,j,r,t)) + VIPM(i,r,t) + VIGM(i,r,t);

Coefficient (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRIFM(i,j,r,t) # share of import i used by sector j in r  #;
Formula (all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRIFM(i,j,r,t) = VIFM(i,j,r,t) / VIM(i,r,t);

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRIPM(i,r,t) # share of import i used by private hhlds in r #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRIPM(i,r,t) = VIPM(i,r,t) / VIM(i,r,t);

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRIGM(i,r,t) # the share of import i used by gov't hhlds in r #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHRIGM(i,r,t) = VIGM(i,r,t) / VIM(i,r,t);

Equation MKTCLIMP
# eq'n assures mkt clearing for imported goods entering each region (HT 2) #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    qim(i,r,t)
        = sum(j,PROD_COMM, SHRIFM(i,j,r,t) * qfm(i,j,r,t))
        + SHRIPM(i,r,t) * qpm(i,r,t)
        + SHRIGM(i,r,t) * qgm(i,r,t);

Coefficient (all,i,ENDWM_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHREM(i,j,r,t) #share of mobile endowment i used by sector j at mkt prices#;
Formula (all,i,ENDWM_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    SHREM(i,j,r,t) = VFM(i,j,r,t) / VOM(i,r,t);

Equation MKTCLENDWM
# eq'n assures mkt clearing for perfectly mobile endowments in each r (HT 4) #
(all,i,ENDWM_COMM)(all,r,REG)(all,t,ALLTIME)
    qo(i,r,t) = sum(j,PROD_COMM, SHREM(i,j,r,t)*qfe(i,j,r,t))+endwslack(i,r,t);
!<
    This equation assures market clearing for perfectly mobile endowments (HT
    4)
>!

Equation MKTCLENDWS
# eq'n assures mkt clearing for imperfectly mobile endowments in each r (HT 5) #
(all,i,ENDWS_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    qoes(i,j,r,t) = qfe(i,j,r,t);
!<
    This equation assures market clearing for sluggish endowments (HT 5)
>!


!<
    8-2. Walras' Law
    ----------------
>!

Variable (all,t,ALLTIME)
    walras_sup(t) # supply in omitted market--global supply of cgds composite #;
Equation WALRAS_S
# Extra eq'n computes change in supply in the omitted market. #
(all,t,ALLTIME)
    walras_sup(t) = pcgdswld(t) + globalcgds(t);
!<
    This is an extra equation which simply computes change in supply in the
    omitted market.  (modified from HT 12 to reflect the value as opposed to
    quantity change, in light of the new treatment of psave(r,t))
>!

Variable (all,t,ALLTIME)
    walras_dem(t) # demand in the omitted market--global demand for savings #;
Equation WALRAS_D
# Extra eq'n computes change in demand in the omitted market. #
(all,t,ALLTIME)
    GLOBINV(t) * walras_dem(t) =
           sum(r,REG, SAVE(r,t) * [psave(r,t) + qsave(r,t)]);
!<
    This is an extra equation which simply computes change in demand in the
    omitted market.  (modified from HT 13 to reflect the value as opposed to
    quantity change)
>!

Variable (all,t,ALLTIME)
    walraslack(t) # slack variable in the omitted market #;
!<
    This is endogenous under normal, GE closure.  If the GE links are broken,
    then this must be swapped with the numeraire, thereby forcing global
    savings to explicitly equal global investment.
>!
Equation WALRAS
# Check Walras' Law.  Value of "walraslack" should be zero. (HT 14) #
(all,t,ALLTIME)
    walras_sup(t) = walras_dem(t) + walraslack(t);
!<
    This equation checks Walras' Law.  The value of walraslack should be zero
    in any GE simulation.  (HT 14)
>!


!<
    ==========
    Appendices
    ==========

    A. Summary Indices
    B. Equivalent Variation
    C. Welfare Decomposition
    D. Terms of Trade Decomposition
>!


!<
    ------------------
    A. Summary Indices
    ------------------

    The following equations calculate many useful summary statistics.  They do
    not generally affect the equilibrium structure of the model, although they
    do include the equation for the usual numeraire variable, "pfactwld". Some
    are documented in Hertel and Tsigas, many are new.

    A-0. Appendix-Specific Variables and Coefficients
    A-1. Factor Price Indices
    A-2. Regional Terms of Trade
    A-3. GDP Indices (Value, Price and Quantity)
    A-4. Aggregate Trade Indices (Value, Price and Quantity)
    A-5. Trade Balance Indices
>!


!<
    A-0. Appendix-Specific Variables and Coefficients
    -------------------------------------------------

    only used in this Summary Indices appendix
>!

Variable (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    vxwfob(i,s,t) # value of merchandise regional exports, by commodity, FOB #;
Variable (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    viwcif(i,s,t) # value of merchandise regional imports, by commodity, CIF #;
Variable (all,r,REG)(all,t,ALLTIME)
    vxwreg(r,t) # value of merchandise exports, by region #;
Variable (all,r,REG)(all,t,ALLTIME)
    viwreg(r,t) # value of merchandise imports, by region, at world prices #;

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VXW(i,r,t) # value of exports by comm. i and region r at FOB prices #;
Formula (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    VXW(m,r,t) = sum(s,REG, VXWD(m,r,s,t)) + VST(m,r,t);
Formula (all,i,NMRG_COMM)(all,r,REG)(all,t,ALLTIME)
    VXW(i,r,t) = sum(s,REG, VXWD(i,r,s,t));

Coefficient (all,r,REG)(all,t,ALLTIME)
    VXWREGION(r,t) # value of exports by region r at FOB prices #;
Formula (all,r,REG)(all,t,ALLTIME)
    VXWREGION(r,t) = sum(i,TRAD_COMM, VXW(i,r,t));

Coefficient (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    VIW(i,s,t) # value of commodity imports i into s at CIF prices #;
Formula (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    VIW(i,s,t) = sum(r,REG, VIWS(i,r,s,t));
Coefficient (all,r,REG)(all,t,ALLTIME)
    VIWREGION(r,t) # value of commodity imports by region r at CIF prices #;
Formula (all,r,REG)(all,t,ALLTIME)
    VIWREGION(r,t) = sum(i,TRAD_COMM, VIW(i,r,t));


!<
    A-1. Factor Price Indices
    -------------------------
>!

Variable (orig_level=1.0)(all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    pfactreal(i,r,t) # ratio of return to primary factor i to CPI in r #;
Equation REALRETURN
# eq'n defines the real rate of return to primary factor i in region r #
(all,i,ENDW_COMM)(all,s,REG)(all,t,ALLTIME)
    pfactreal(i,s,t) = pm(i,s,t) - ppriv(s,t);
!<
    This equation defines the real rate of return to primary factor i in
    region r (new).
>!

Coefficient (all,r,REG)(all,t,ALLTIME)
    VENDWREG(r,t) # value of primary factors, at mkt prices, by region #;
Formula (all,r,REG)(all,t,ALLTIME)
    VENDWREG(r,t) = sum(i,ENDW_COMM, VOM(i,r,t));

Variable (orig_level=1.0)(all,r,REG)(all,t,ALLTIME)
    pfactor(r,t) # market price index of primary factors, by region #;
Equation PRIMFACTPR
# computes % change in price index of primary factors, by region #
(all,r,REG)(all,t,ALLTIME)
    VENDWREG(r,t) * pfactor(r,t) = sum(i,ENDW_COMM, VOM(i,r,t) * pm(i,r,t));

Coefficient (all,t,ALLTIME)
    VENDWWLD(t) # value of primary factors, at mkt prices, worldwide #;
Formula (all,t,ALLTIME)
    VENDWWLD(t) = sum(r,REG, VENDWREG(r,t));
Variable (orig_level=1.0)(all,t,ALLTIME)
    pfactwld(t) # world price index of primary factors #;
Equation PRIMFACTPRWLD
# computes % change in global price index of primary factors #
(all,t,ALLTIME)
    VENDWWLD(t) * pfactwld(t) = sum(r,REG, VENDWREG(r,t) * pfactor(r,t));


!<
    A-2. Regional Terms of Trade
    ----------------------------

    The next three equations correspond to Table 10 of Hertel and Tsigas on
    Regional Terms of Trade.
>!

Variable (orig_level=1.0)(all,r,REG)(all,t,ALLTIME)
    psw(r,t) # index of prices received for tradeables produced in r #;
Equation REGSUPRICE
# estimate change in index of prices received for tradeables i produced in r #
(all,r,REG)(all,t,ALLTIME)
    VXWREGION(r,t) * psw(r,t)
        = sum(i,TRAD_COMM, sum(s,REG, VXWD(i,r,s,t) * pfob(i,r,s,t)))
        + sum(m,MARG_COMM, VST(m,r,t) * pm(m,r,t));
!<
    This equation estimates the change in the index of prices received for
    tradeable products produced in r.  (modified from HT 64 to eliminate the
    investment component)
>!

Variable (orig_level=1.0)(all,r,REG)(all,t,ALLTIME)
    pdw(r,t) # index of prices paid for tradeables used in region r #;
Equation REGDEMPRICE
# estimate change in index of prices paid for tradeable products used in r #
(all,r,REG)(all,t,ALLTIME)
    VIWREGION(r,t) * pdw(r,t)
        = sum(i,TRAD_COMM, sum(k,REG, VIWS(i,k,r,t) * pcif(i,k,r,t)));
!<
    This equation estimates the change in the index of prices paid for
    tradeable products used in r.  (modified from HT 65 to eliminate savings,t)
>!

Variable (orig_level=1.0)(all,r,REG)(all,t,ALLTIME)
    tot(r,t) # terms of trade for region r: tot(r,t) = psw(r,t) - pdw(r,t) #;
Equation TOTeq
# terms of trade equation computed as difference in psw and pdw (HT 66) #
(all,r,REG)(all,t,ALLTIME)
    tot(r,t) = psw(r,t) - pdw(r,t);


!<
    A-3. GDP Indices (Value, Price and Quantity)
    --------------------------------------------
>!

Coefficient (all,r,REG)(all,t,ALLTIME)
    GDP(r,t) # Gross Domestic Product in region r #;
Formula (all,s,REG)(all,t,ALLTIME)
    GDP(s,t)
        = sum(i,TRAD_COMM, VPA(i,s,t))
        + sum(i,TRAD_COMM, VGA(i,s,t))
        + sum(k,CGDS_COMM, VOA(k,s,t))
        + sum(i,TRAD_COMM, sum(r,REG, VXWD(i,s,r,t)))
        + sum(m,MARG_COMM, VST(m,s,t))
        - sum(i,TRAD_COMM, sum(r,REG, VIWS(i,r,s,t)));
!<
    Gross Domestic Product in region r.  Trade is valued at FOB and CIF
    prices.
>!

Variable (all,r,REG)(all,t,ALLTIME)
    vgdp(r,t) # change in value of GDP #;
Equation VGDP_r
# change in value of GDP (HT 70) #
(all,r,REG)(all,t,ALLTIME)
    GDP(r,t) * vgdp(r,t)
        = sum(i,TRAD_COMM, VGA(i,r,t) * [qg(i,r,t) + pg(i,r,t)])
        + sum(i,TRAD_COMM, VPA(i,r,t) * [qp(i,r,t) + pp(i,r,t)])
        + REGINV(r,t) * [qcgds(r,t) + pcgds(r,t)]
        + sum(i,TRAD_COMM, sum(s,REG, VXWD(i,r,s,t) * [qxs(i,r,s,t)
                 + pfob(i,r,s,t)]))
        + sum(m,MARG_COMM, VST(m,r,t) * [qst(m,r,t) + pm(m,r,t)])
        - sum(i,TRAD_COMM, sum(s,REG,
            VIWS(i,s,r,t) * [qxs(i,s,r,t) + pcif(i,s,r,t)]));

Variable (orig_level=1.0)(all,r,REG)(all,t,ALLTIME)
    pgdp(r,t) # GDP price index #;
Equation PGDP_r
# GDP price index (HT 71) #
(all,r,REG)(all,t,ALLTIME)
    GDP(r,t) * pgdp(r,t)
        = sum(i,TRAD_COMM, VGA(i,r,t) * pg(i,r,t))
        + sum(i,TRAD_COMM, VPA(i,r,t) * pp(i,r,t))
        + REGINV(r,t) * pcgds(r,t)
        + sum(i,TRAD_COMM, sum(s,REG, VXWD(i,r,s,t) * pfob(i,r,s,t)))
        + sum(m,MARG_COMM, VST(m,r,t) * pm(m,r,t))
        - sum(i,TRAD_COMM, sum(s,REG, VIWS(i,s,r,t) * pcif(i,s,r,t)));

Variable (orig_level=GDP)(all,r,REG)(all,t,ALLTIME)
    qgdp(r,t) # GDP quantity index #;
Equation QGDP_r
# GDP quantity index #
(all,r,REG)(all,t,ALLTIME)
    GDP(r,t) * qgdp(r,t)
        = sum(i,TRAD_COMM, VGA(i,r,t) * qg(i,r,t))
        + sum(i,TRAD_COMM, VPA(i,r,t) * qp(i,r,t))
        + REGINV(r,t) * qcgds(r,t)
        + sum(i,TRAD_COMM, sum(s,REG, VXWD(i,r,s,t) * qxs(i,r,s,t)))
        + sum(m,MARG_COMM, VST(m,r,t) * qst(m,r,t))
        - sum(i,TRAD_COMM, sum(s,REG, VIWS(i,s,r,t) * qxs(i,s,r,t)));
!<
    modified from HT 72 for use with AnalyzeGE
>!

Variable (all,i,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    compvalad(i,r,t) # composition of value added for good i and region r #;
Equation COMPVALADEQ
# track change in composition of value added #
(all,i,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    compvalad(i,r,t) = qo(i,r,t) - qgdp(r,t);


!<
    A-4. Aggregate Trade Indices (Value, Price and Quantity)
    --------------------------------------------------------
>!


!<
    Common Variables and Coefficients
    Value Indices for Aggregate Trade
    Price Indices for Aggregate Trade
    Quantity Indices for Aggregate Trade
>!


!<
    Common Variables and Coefficients
    .................................

    only used in this Aggregate Trade Indices section
>!

Variable (orig_level=1.0)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    pxw(i,r,t) # aggregate exports price index of i from region r #;

Coefficient (all,i,TRAD_COMM)(all,t,ALLTIME)
    VXWCOMMOD(i,t) # value of world exports by commodity i at FOB prices #;
Formula (all,i,TRAD_COMM)(all,t,ALLTIME)
    VXWCOMMOD(i,t) = sum(r,REG, VXW(i,r,t));

Coefficient (all,t,ALLTIME)
    VXWLD(t) # value of commodity exports, FOB, globally #;
Formula
(all,t,ALLTIME)
    VXWLD(t) = sum(r,REG, VXWREGION(r,t));

Coefficient (all,i,TRAD_COMM)(all,t,ALLTIME)
    VIWCOMMOD(i,t) # global value of commodity imports, CIF, by commodity #;
Formula (all,i,TRAD_COMM)(all,t,ALLTIME)
    VIWCOMMOD(i,t) = sum(r,REG, VIW(i,r,t));

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    PW_PM(i,r,t) # ratio of world to domestic prices #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    PW_PM(i,r,t) = sum(s,REG, VXWD(i,r,s,t)) / sum(s,REG, VXMD(i,r,s,t));
Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VOW(i,r,t) #value of output in r at FOB including transportation services#;
Formula (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    VOW(m,r,t) = VDM(m,r,t) * PW_PM(m,r,t)
                    + sum(s,REG, VXWD(m,r,s,t)) + VST(m,r,t);
Formula (all,i,NMRG_COMM)(all,r,REG)(all,t,ALLTIME)
    VOW(i,r,t) = VDM(i,r,t) * PW_PM(i,r,t) + sum(s,REG, VXWD(i,r,s,t));

Coefficient (all,i,TRAD_COMM)(all,t,ALLTIME)
    VWOW(i,t) # value of world supply at world prices for i #;
Formula (all,i,TRAD_COMM)(all,t,ALLTIME)
    VWOW(i,t) = sum(r,REG, VOW(i,r,t));

Coefficient (all,i,TRAD_COMM)(all,t,ALLTIME)
    VWOU(i,t) # value of world output of i at user prices #;
Formula (all,i,TRAD_COMM)(all,t,ALLTIME)
    VWOU(i,t) = sum(s,REG, [VPA(i,s,t) + VGA(i,s,t)]
                     + sum(j,PROD_COMM, VFA(i,j,s,t)));


!<
    Value Indices for Aggregate Trade
    .................................
>!

Equation VREGEX_ir_MARG
# the change in FOB value of exports of m from r #
(all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    VXW(m,r,t) * vxwfob(m,r,t)
        = sum(s,REG, VXWD(m,r,s,t) * [qxs(m,r,s,t) + pfob(m,r,s,t)])
        + VST(m,r,t) * [qst(m,r,t) + pm(m,r,t)];
Equation VREGEX_ir_NMRG
# the change in FOB value of exports of commodity i from r (HT 73) #
(all,i,NMRG_COMM)(all,r,REG)(all,t,ALLTIME)
    VXW(i,r,t) * vxwfob(i,r,t)
        = sum(s,REG, VXWD(i,r,s,t) * [qxs(i,r,s,t) + pfob(i,r,s,t)]);

Equation VREGEX_r
# computes % change in value of merchandise exports, by region (HT 75) #
(all,r,REG)(all,t,ALLTIME)
    VXWREGION(r,t) * vxwreg(r,t) = sum(i,TRAD_COMM, VXW(i,r,t) * vxwfob(i,r,t));

Variable (all,i,TRAD_COMM)(all,t,ALLTIME)
    vxwcom(i,t) # value of global merchandise exports by commodity #;
Equation VWLDEX_i
# computes % change in FOB value of global exports, by commodity (HT 77) #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VXWCOMMOD(i,t) * vxwcom(i,t) = sum(r,REG, VXW(i,r,t) * vxwfob(i,r,t));

Variable (all,t,ALLTIME)
    vxwwld(t) # value of world trade #;
Equation VWLDEX
# computes % change in value of global exports (HT 79) #
(all,t,ALLTIME)
    VXWLD(t) * vxwwld(t) = sum(r,REG, VXWREGION(r,t) * vxwreg(r,t));

Equation VREGIM_is
# the change in CIF value of imports of commodity i into s (HT 74) #
(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    VIW(i,s,t) * viwcif(i,s,t)
        = sum(r,REG, VIWS(i,r,s,t) * [pcif(i,r,s,t) + qxs(i,r,s,t)]);

Equation VREGIM_s
# computes % change in value of imports, CIF basis, by region (HT 76) #
(all,s,REG)(all,t,ALLTIME)
    VIWREGION(s,t) * viwreg(s,t) = sum(i,TRAD_COMM, VIW(i,s,t) * viwcif(i,s,t));

Variable (all,i,TRAD_COMM)(all,t,ALLTIME)
    viwcom(i,t) # value of global merchandise imports i, at world prices #;
Equation VWLDIM_i
# computes % change in value of global imports, by commodity (HT 78) #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VIWCOMMOD(i,t) * viwcom(i,t) = sum(s,REG, VIW(i,s,t) * viwcif(i,s,t));

Variable (all,i,TRAD_COMM)(all,t,ALLTIME)
    valuew(i,t) # value of world supply of good i #;
Equation VWLDOUT
# change in value of world output of comm. i at FOB prices (HT 80) #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VWOW(i,t) * valuew(i,t) = sum(r,REG, VOW(i,r,t) * [pxw(i,r,t) + qo(i,r,t)]);

Variable (all,i,TRAD_COMM)(all,t,ALLTIME)
    valuewu(i,t) # value of world supply of good i at user prices #;
Equation VWLDOUTUSE
# change in value of world output of commodity i at user prices #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VWOU(i,t) * valuewu(i,t)
        = sum(s,REG, VPA(i,s,t) * [pp(i,s,t) + qp(i,s,t)]
        + VGA(i,s,t) * [pg(i,s,t) + qg(i,s,t)]
        + sum(j,PROD_COMM, VFA(i,j,s,t) * [pf(i,j,s,t) + qf(i,j,s,t)]));


!<
    Price Indices for Aggregate Trade
    .................................
>!

Equation PREGEX_ir_MARG
# change in FOB price index of exports of m from r #
(all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    VXW(m,r,t) * pxw(m,r,t)
        = sum(s,REG, VXWD(m,r,s,t) * pfob(m,r,s,t)) + VST(m,r,t) * pm(m,r,t);

Equation PREGEX_ir_NMRG
# change in FOB price index of exports of commodity i from r (HT 81) #
(all,i,NMRG_COMM)(all,r,REG)(all,t,ALLTIME)
    VXW(i,r,t) * pxw(i,r,t) = sum(s,REG, VXWD(i,r,s,t) * pfob(i,r,s,t));

Variable (orig_level=1.0)(all,r,REG)(all,t,ALLTIME)
    pxwreg(r,t) # price index of merchandise exports, by region #;
Equation PREGEX_r
# computes % change in price index of exports, by region (HT 83) #
(all,r,REG)(all,t,ALLTIME)
    VXWREGION(r,t) * pxwreg(r,t) = sum(i,TRAD_COMM, VXW(i,r,t) * pxw(i,r,t));

Variable (orig_level=1.0)(all,i,TRAD_COMM)(all,t,ALLTIME)
    pxwcom(i,t) # price index of global merchandise exports by commodity #;
Equation PWLDEX_i
# computes % change in price index of exports, by commodity (HT 85) #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VXWCOMMOD(i,t) * pxwcom(i,t) = sum(r,REG, VXW(i,r,t) * pxw(i,r,t));

Variable (orig_level=1.0)(all,t,ALLTIME)
    pxwwld(t) # price index of world trade #;
Equation PWLDEX
# computes % change in price index of global exports (HT 87) #
(all,t,ALLTIME)
    VXWLD(t) * pxwwld(t) = sum(r,REG, VXWREGION(r,t) * pxwreg(r,t));

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    piw(i,r,t) # world price of composite import i in region r #;
Equation PREGIM_is
# change in CIF price index of imports of commodity i into s (HT 82) #
(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    VIW(i,s,t) * piw(i,s,t) = sum(r,REG, VIWS(i,r,s,t) * pcif(i,r,s,t));

Variable (orig_level=1.0)(all,r,REG)(all,t,ALLTIME)
    piwreg(r,t) # price index of merchandise imports, by region #;
Equation PREGIM_s
# computes % change in price index of imports, by region (HT 84) #
(all,s,REG)(all,t,ALLTIME)
    VIWREGION(s,t) * piwreg(s,t) = sum(i,TRAD_COMM, VIW(i,s,t) * piw(i,s,t));

Variable (orig_level=1.0)(all,i,TRAD_COMM)(all,t,ALLTIME)
    piwcom(i,t) # price index of global merchandise imports by commodity #;
Equation PWLDIM_i
# computes % change in price index of imports, by commodity (HT 86) #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VIWCOMMOD(i,t) * piwcom(i,t) = sum(s,REG, VIW(i,s,t) * piw(i,s,t));

Variable (all,i,TRAD_COMM)(all,t,ALLTIME)
    pw(i,t) # world price index for total good i supplies #;
Equation PWLDOUT
# change in index of world prices, FOB, for total production of i (HT 88) #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VWOW(i,t) * pw(i,t) = sum(r,REG, VOW(i,r,t) * pxw(i,r,t));

Variable (orig_level=1.0)(all,i,TRAD_COMM)(all,t,ALLTIME)
    pwu(i,t) # world price index for total good i supplies at user prices #;
Equation PWLDUSE
# change in index of user prices for deflating world production of i #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VWOU(i,t) * pwu(i,t)
        = sum(s,REG, VPA(i,s,t) * pp(i,s,t)
        + VGA(i,s,t) * pg(i,s,t)
        + sum(j,PROD_COMM, VFA(i,j,s,t) * pf(i,j,s,t)));


!<
    Quantity Indices for Aggregate Trade
    ....................................
>!

Variable (orig_level=VXW)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    qxw(i,r,t) # aggregate exports of i from region r, FOB weights #;
Equation QREGEX_ir_MARG
# change in volume of exports of margin commodity m from r #
(all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    VXW(m,r,t) * qxw(m,r,t)
        = sum(s,REG, VXWD(m,r,s,t) * qxs(m,r,s,t)) + VST(m,r,t) * qst(m,r,t);
Equation QREGEX_ir_NMRG
# change in volume of exports of non-margin commodity i from r #
(all,i,NMRG_COMM)(all,r,REG)(all,t,ALLTIME)
    VXW(i,r,t) * qxw(i,r,t) = sum(s,REG, VXWD(i,r,s,t) * qxs(i,r,s,t));
!<
    modified from HT 89 for use with AnalyzeGE
>!

Variable (orig_level=VXWREGION)(all,r,REG)(all,t,ALLTIME)
    qxwreg(r,t) # volume of merchandise exports, by region #;
Equation QREGEX_r
# computes % change in quantity index of exports, by region #
(all,r,REG)(all,t,ALLTIME)
    VXWREGION(r,t) * qxwreg(r,t) = sum(i,TRAD_COMM, VXW(i,r,t) * qxw(i,r,t));
!<
    modified from HT 91 for use with AnalyzeGE
>!

Variable (orig_level=VXWCOMMOD)(all,i,TRAD_COMM)(all,t,ALLTIME)
    qxwcom(i,t) # volume of global merchandise exports by commodity #;
Equation QWLDEX_i
# computes % change in quantity index of exports, by commodity #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VXWCOMMOD(i,t) * qxwcom(i,t) = sum(r,REG, VXW(i,r,t) * qxw(i,r,t));
!<
    modified from HT 93 for use with AnalyzeGE
>!

Variable (orig_level=VXWLD)(all,t,ALLTIME)
    qxwwld(t) # volume of world trade #;
Equation QWLDEX
# computes % change in quantity index of global exports #
(all,t,ALLTIME)
    VXWLD(t) * qxwwld(t) = sum(r,REG, VXWREGION(r,t) * qxwreg(r,t));
!<
    modified from HT 95 for use with AnalyzeGE
>!

Variable (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    qiw(i,s,t) # aggregate imports of i into region s, CIF weights #;
Equation QREGIM_is
# change in volume of imports of commodity i into s #
(all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    VIW(i,s,t) * qiw(i,s,t) = sum(r,REG, VIWS(i,r,s,t) * qxs(i,r,s,t));
!<
    modified from HT 90 for use with AnalyzeGE
>!

Variable (orig_level=VIWREGION)(all,r,REG)(all,t,ALLTIME)
    qiwreg(r,t) # volume of merchandise imports, by region #;
Equation QREGIM_s
# computes % change in quantity index of imports, by region #
(all,s,REG)(all,t,ALLTIME)
    VIWREGION(s,t) * qiwreg(s,t) = sum(i,TRAD_COMM, VIW(i,s,t) * qiw(i,s,t));
!<
    modified from HT 92 for use with AnalyzeGE
>!

Variable (orig_level=VIWCOMMOD)(all,i,TRAD_COMM)(all,t,ALLTIME)
    qiwcom(i,t) # volume of global merchandise imports by commodity #;
Equation QWLDIM_i
# computes % change in quantity index of imports, by commodity #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VIWCOMMOD(i,t) * qiwcom(i,t) = sum(s,REG, VIW(i,s,t) * qiw(i,s,t));
!<
    modified from HT 94 for use with AnalyzeGE
>!

Variable (all,i,TRAD_COMM)(all,t,ALLTIME)
    qow(i,t) # quantity index for world supply of good i #;
Equation QWLDOUT
# change in index of world production of i #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VWOW(i,t) * qow(i,t) = sum(r,REG, VOW(i,r,t) * qo(i,r,t));
!<
    modified from HT 96 for use with AnalyzeGE
>!

Variable (orig_level=VWOU)(all,i,TRAD_COMM)(all,t,ALLTIME)
    qowu(i,t) # quantity index for world supply of good i at user prices #;
Equation QWLDOUTU
# change in index of world production of i evaluated at user prices #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    VWOU(i,t) * qowu(i,t)
        = sum(s,REG, VPA(i,s,t) * qp(i,s,t)
        + VGA(i,s,t) * qg(i,s,t)
        + sum(j,PROD_COMM, VFA(i,j,s,t) * qf(i,j,s,t)));


!<
    A-5. Trade Balance Indices
    --------------------------
>!

Variable (change)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    DTBALi(i,r,t) # change in trade balance by i and by r, $ US million #;
!<
    A positive value indicates that the change in exports exceeds the change
    in imports.
>!
Equation TRADEBAL_i
# computes change in trade balance by commodity and by region (HT 97) #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    DTBALi(i,r,t)
        = [VXW(i,r,t) / 100] * vxwfob(i,r,t)
          - [VIW(i,r,t) / 100] * viwcif(i,r,t);

Variable (change)(all,r,REG)(all,t,ALLTIME)
    DTBAL(r,t) # change in trade balance X - M, $ US million #;
Equation TRADEBALANCE
# computes change in trade balance (X - M), by region (HT 98) #
(all,r,REG)(all,t,ALLTIME)
    DTBAL(r,t)
        = [VXWREGION(r,t) / 100] * vxwreg(r,t)
          - [VIWREGION(r,t) / 100] * viwreg(r,t);

!<
    In order to maintain homogeneity in the presence of a fixed trade balance,
    it is useful to have a nominal variable which this is measured against.
    The next equation provides this, and we recommend users fix DTBALR instead
    of fixing DTBAL in future simulations.  The strategy is the same one used
    above for taxes.
>!

Coefficient (all,r,REG)(all,t,ALLTIME)
    TBAL(r,t) # trade balance for region r #;
Formula (all,r,REG)(all,t,ALLTIME)
    TBAL(r,t) = VXWREGION(r,t) - VIWREGION(r,t);

Variable (change)(all,r,REG)(all,t,ALLTIME)
    DTBALR(r,t) # change in ratio of trade balance to regional income #;
Equation DTBALRATIO
# change in ratio of trade balance to regional income #
(all,r,REG)(all,t,ALLTIME)
    100 * INCOME(r,t) * DTBALR(r,t) = 100 * DTBAL(r,t) - TBAL(r,t) * y(r,t);


!<
    -----------------------
    B. Equivalent Variation
    -----------------------

    B-0. Appendix-Specific Variables and Coefficients
    B-1. Government Consumption Shadow Demand System
    B-2. Private Consumption Shadow Demand System
    B-3. Regional Household Shadow Demand System
    B-4. Equivalent Variation

    This appendix calculates equivalent variation "EV" and world equivalent
    variation, "WEV", by determining the income "yev" that would be required
    to achieve the current actual utility level "u" in a shadow demand system
    in which prices are fixed.

    Section B-2 calculates the utility elasticity of private consumption
    expenditure, "ueprivev", within a shadow demand system for private
    consumption, for use in section B-3.  B-3 calculates private consumption
    expenditure "ypev" for use in B-2, and regional income "yev" for use in
    B-4, within a shadow demand system for the regional household.  B-4
    calculates "EV" and "WEV".
>!


!<
    B-0. Appendix-Specific Variables and Coefficients
    -------------------------------------------------

    only used in this Equivalent Variation section of the Summary Indices
    appendix
>!

Variable (all,r,REG)(all,t,ALLTIME)
    uelasev(r,t) # elasticity of cost of utility wrt utility, for EV calc. #;
Variable (all,r,REG)(all,t,ALLTIME)
    ueprivev(r,t) # utility elasticity of private consn expenditure, for EV calc. #;
Variable (all,r,REG)(all,t,ALLTIME)
    ugev(r,t) # per capita utility from gov't expend., for EV calc. #;
Variable (all,r,REG)(all,t,ALLTIME)
    upev(r,t) # per capita utility from private expend., for EV calc. #;
Variable (all,r,REG)(all,t,ALLTIME)
    qsaveev(r,t) # total quantity of savings demanded, for EV calc. #;
Variable (all,r,REG)(all,t,ALLTIME)
    yev(r,t) # regional household income in region r, for EV calc. #;
Variable (all,r,REG)(all,t,ALLTIME)
    ypev(r,t) # private consumption expenditure in region r, for EV calc. #;
Variable (all,r,REG)(all,t,ALLTIME)
    ygev(r,t) # government consumption expenditure in region r, for EV calc. #;

Coefficient (all,r,REG)(all,t,ALLTIME)
    INCOMEEV(r,t) # regional income, for EV calc. #;
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    INCOMEEV(r,t) = INCOME(r,t);
Update (all,r,REG)(all,t,ALLTIME)
    INCOMEEV(r,t) = yev(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    UTILPRIVEV(r,t) # utility from private consumption, for EV calcs #;
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    UTILPRIVEV(r,t) = UTILPRIV(r,t);
Update (all,r,REG)(all,t,ALLTIME)
    UTILPRIVEV(r,t) = upev(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    UTILGOVEV(r,t) # utility from private consumption, for EV calcs #;
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    UTILGOVEV(r,t) = UTILGOV(r,t);
Update (all,r,REG)(all,t,ALLTIME)
    UTILGOVEV(r,t) = ugev(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    UTILSAVEEV(r,t) # utility from private consumption, for EV calcs #;
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    UTILSAVEEV(r,t) = UTILSAVE(r,t);
Update (change)(all,r,REG)(all,t,ALLTIME)
    UTILSAVEEV(r,t) = [[qsaveev(r,t) - pop(r,t)] / 100] * UTILSAVEEV(r,t);


!<
    B-1. Government Consumption Shadow Demand System
    ------------------------------------------------
>!

Equation GOVUSHD
# utility from government consumption in r #
(all,r,REG)(all,t,ALLTIME)
    ygev(r,t) - pop(r,t) = ugev(r,t);


!<
    B-2. Private Consumption Shadow Demand System
    ---------------------------------------------
>!

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    qpev(i,r,t) # private hhld demand for commodity i in region r, for EV calc. #;

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VPAEV(i,r,t) # private hhld expend. on i in r valued at agent's prices, for EV calc. #;
Formula (initial)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VPAEV(i,r,t) = VPA(i,r,t);
Update (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    VPAEV(i,r,t) = qpev(i,r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    VPAREGEV(r,t) # private consumption expenditure in region r, for EV calc. #;
Formula (all,r,REG)(all,t,ALLTIME)
    VPAREGEV(r,t) = sum(i,TRAD_COMM, VPAEV(i,r,t));
!<
    VPAREGEV should agree with PRIVEXPEV.
>!

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CONSHREV(i,r,t) # share of private hhld consn devoted to good i in r, for EV calc. #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CONSHREV(i,r,t) = VPAEV(i,r,t) / VPAREGEV(r,t);
Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    EYEV(i,r,t) # expend. elast. of private hhld demand for i in r, for EV calc. #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    EYEV(i,r,t)
        = [1.0 / sum(n,TRAD_COMM, CONSHREV(n,r,t) * INCPAR(n,r,t))]
        * [INCPAR(i,r,t) * [1.0 - ALPHA(i,r,t)]
            + sum(n,TRAD_COMM, CONSHREV(n,r,t) * INCPAR(n,r,t) * ALPHA(n,r,t))]
        + ALPHA(i,r,t)
        - sum(n,TRAD_COMM, CONSHREV(n,r,t) * ALPHA(n,r,t));

Equation PRIVDMNDSEV
    # private hhld demands for composite commodities, for EV calc. #
    (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    qpev(i,r,t) - pop(r,t) = EYEV(i,r,t) * [ypev(r,t) - pop(r,t)];
!<
    Prices are held constant for the EV calculation and so do not appear here.
>!

Coefficient (all,r,REG)(all,t,ALLTIME)
    UELASPRIVEV(r,t) # elast. of cost wrt utility from private consn, for EV calc. #;
Formula (all,r,REG)(all,t,ALLTIME)
    UELASPRIVEV(r,t) = sum(i,TRAD_COMM, CONSHREV(i,r,t) * INCPAR(i,r,t));

Equation PRIVATEUEV
# computation of utility from private consumption in r (HT 45) #
(all,r,REG)(all,t,ALLTIME)
    ypev(r,t) - pop(r,t) = UELASPRIVEV(r,t) * upev(r,t);

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    XWCONSHREV(i,r,t) # expansion-parameter-weighted consumption share, for EV calc. #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    XWCONSHREV(i,r,t) = CONSHREV(i,r,t) * INCPAR(i,r,t) / UELASPRIVEV(r,t);

Equation UTILELASPRIVEV
    # elasticity of cost wrt utility from private consn, for EV calc. #
    (all,r,REG)(all,t,ALLTIME)
    ueprivev(r,t)
        = sum(i,TRAD_COMM, XWCONSHREV(i,r,t) * [qpev(i,r,t) - ypev(r,t)]);
!<
    Prices are held constant for the EV calculation and so do not appear here.
>!


!<

    B-3. Regional Household Shadow Demand System
    --------------------------------------------
>!

Variable (all,r,REG)(all,t,ALLTIME)
    ysaveev(r,t) # NET savings expenditure, for EV calc. #;

Coefficient (all,r,REG)(all,t,ALLTIME)
    PRIVEXPEV(r,t) # private consumption expenditure in region r, for EV calc. #;
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    PRIVEXPEV(r,t) = PRIVEXP(r,t);
Update (all,r,REG)(all,t,ALLTIME)
    PRIVEXPEV(r,t) = ypev(r,t);
!<
    PRIVEXPEV should agree with VPAREGEV.
>!

Coefficient (all,r,REG)(all,t,ALLTIME)
    GOVEXPEV(r,t) # government consumption expenditure in region r, for EV calc. #;
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    GOVEXPEV(r,t) = GOVEXP(r,t);
Update (all,r,REG)(all,t,ALLTIME)
    GOVEXPEV(r,t) = ygev(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    SAVEEV(r,t) # saving in region r, for EV calc. #;
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    SAVEEV(r,t) = SAVE(r,t);
Update (all,r,REG)(all,t,ALLTIME)
    SAVEEV(r,t) = ysaveev(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    XSHRPRIVEV(r,t) # private expenditure share in regional income, for EV calc. #;
Formula (all,r,REG)(all,t,ALLTIME)
    XSHRPRIVEV(r,t) = PRIVEXPEV(r,t) / INCOMEEV(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    XSHRGOVEV(r,t) # government expenditure share in regional income, for EV calc. #;
Formula (all,r,REG)(all,t,ALLTIME)
    XSHRGOVEV(r,t) = GOVEXPEV(r,t) / INCOMEEV(r,t);

Coefficient (all,r,REG)(all,t,ALLTIME)
    XSHRSAVEEV(r,t) # saving share in regional income, for EV calc. #;
Formula (all,r,REG)(all,t,ALLTIME)
    XSHRSAVEEV(r,t) = SAVEEV(r,t) / INCOMEEV(r,t);

Variable (all,r,REG)(all,t,ALLTIME)
    dpavev(r,t) # average distribution parameter shift, for EV calc. #;
Equation DPARAVEV
# average distribution parameter shift, for EV calc. #
    (all,r,REG)(all,t,ALLTIME)
    dpavev(r,t)
        = XSHRPRIVEV(r,t) * dppriv(r,t)
        + XSHRGOVEV(r,t) * dpgov(r,t)
        + XSHRSAVEEV(r,t) * dpsave(r,t);

Equation UTILITELASTICEV
    # elasticity of cost of utility wrt utility, for EV calc. #
    (all,r,REG)(all,t,ALLTIME)
    uelasev(r,t) = XSHRPRIV(r,t) * ueprivev(r,t) - dpavev(r,t);

Equation PCONSEXPEV
# private consumption expenditure, for EV calc. #
    (all,r,REG)(all,t,ALLTIME)
    ypev(r,t) - yev(r,t) = -[ueprivev(r,t) - uelasev(r,t)] + dppriv(r,t);

Equation GOVCONSEXPEV
# government consumption expenditure #
(all,r,REG)(all,t,ALLTIME)
    ygev(r,t) - yev(r,t) = uelasev(r,t) + dpgov(r,t);

Equation SAVINGEV
# saving #
(all,r,REG)(all,t,ALLTIME)
    ysaveev(r,t) - yev(r,t) = uelasev(r,t) + dpsave(r,t);

Equation SAVEUEV
# saving #
(all,r,REG)(all,t,ALLTIME)
    qsaveev(r,t) = ysaveev(r,t);

!<
    Note that because psave doesn't change, qsaveev moves with ysaveev.
>!

Coefficient (all,r,REG)(all,t,ALLTIME)
    UTILELASEV(r,t) # elasticity of cost of utility wrt utility, for EV calc. #;
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    UTILELASEV(r,t) = UTILELAS(r,t);
Update (all,r,REG)(all,t,ALLTIME)
    UTILELASEV(r,t) = uelasev(r,t);

Equation INCOME_EQUIV
# equivalent income #
(all,r,REG)(all,t,ALLTIME)
    u(r,t)
        = au(r,t)
        + DPARPRIV(r,t) * loge(UTILPRIVEV(r,t)) * dppriv(r,t)
        + DPARGOV(r,t) * loge(UTILGOVEV(r,t)) * dpgov(r,t)
        + DPARSAVE(r,t) * loge(UTILSAVEEV(r,t)) * dpsave(r,t)
        + [1.0 / UTILELASEV(r,t)] * [yev(r,t) - pop(r,t)];


!<
    B-4. Equivalent Variation
    -------------------------
>!

Variable (change)(all,r,REG)(all,t,ALLTIME)
    EV(r,t) # equivalent variation, $ US million #;
Equation EVREG
# regional EV (HT 67) #
(all,r,REG)(all,t,ALLTIME)
    EV(r,t) = [INCOMEEV(r,t) / 100] * yev(r,t);

Variable (change)(all,t,ALLTIME)
    WEV(t) # equivalent variation for the world #;
Equation EVWLD
# EV for the world (HT 68) #
(all,t,ALLTIME)
    WEV(t) = sum(r,REG, EV(r,t));


!<
    ------------------------
    C. Welfare Decomposition
    ------------------------
    See GTAP Technical Paper No. 5 for derivation and interpretation.
>!

Coefficient (all,r,REG)(all,t,ALLTIME)
    EVSCALFACT(r,t) # equivalent variation scaling factor #;
Formula (all,r,REG)(all,t,ALLTIME)
    EVSCALFACT(r,t) =
         [UTILELASEV(r,t) / UTILELAS(r,t)] * [INCOMEEV(r,t) / INCOME(r,t)];

Coefficient (all,m,MARG_COMM)(all,s,REG)(all,t,ALLTIME)
    VTMD(m,s,t) # aggregate value of svce m in shipments to s #;
Formula (all,m,MARG_COMM)(all,s,REG)(all,t,ALLTIME)
    VTMD(m,s,t) = sum(i,TRAD_COMM, sum(r,REG, VTMFSD(m,i,r,s,t)));

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    EV_ALT(r,t) # regional EV computed in alternative way #;
Equation EV_DECOMPOSITION
# decomposition of Equivalent Variation #
(all,r,REG)(all,t,ALLTIME)
    EV_ALT(r,t)
        = -[0.01 * UTILELASEV(r,t) * INCOMEEV(r,t)]
        * [DPARPRIV(r,t) * loge(UTILPRIVEV(r,t) / UTILPRIV(r,t)) * dppriv(r,t)
            + DPARGOV(r,t) * loge(UTILGOVEV(r,t) / UTILGOV(r,t)) * dpgov(r,t)
            + DPARSAVE(r,t)*loge(UTILSAVEEV(r,t) / UTILSAVE(r,t)) * dpsave(r,t)]
        + [0.01 * EVSCALFACT(r,t)]
        * [sum(i,NSAV_COMM, PTAX(i,r,t) * [qo(i,r,t) - pop(r,t)])
            + sum(i,ENDW_COMM, sum(j,PROD_COMM,
                ETAX(i,j,r,t) * [qfe(i,j,r,t) - pop(r,t)]))
            + sum(i,TRAD_COMM, sum(j,PROD_COMM,
                IFTAX(i,j,r,t) * [qfm(i,j,r,t) - pop(r,t)]))
            + sum(i,TRAD_COMM, sum(j,PROD_COMM,
                DFTAX(i,j,r,t) * [qfd(i,j,r,t) - pop(r,t)]))
            + sum(i,TRAD_COMM, IPTAX(i,r,t) * [qpm(i,r,t) - pop(r,t)])
            + sum(i,TRAD_COMM, DPTAX(i,r,t) * [qpd(i,r,t) - pop(r,t)])
            + sum(i,TRAD_COMM, IGTAX(i,r,t) * [qgm(i,r,t) - pop(r,t)])
            + sum(i,TRAD_COMM, DGTAX(i,r,t) * [qgd(i,r,t) - pop(r,t)])
            + sum(i,TRAD_COMM,sum(s,REG,XTAXD(i,r,s,t)*[qxs(i,r,s,t)-pop(r,t)]))
            + sum(i,TRAD_COMM,sum(s,REG, MTAX(i,s,r,t)*[qxs(i,s,r,t)-pop(r,t)]))
            + sum(i,ENDW_COMM, VOA(i,r,t) * [qo(i,r,t) - pop(r,t)])
            - VDEP(r,t) * [qo("capital",r,t) - pop(r,t)]
            + sum(i,PROD_COMM, VOA(i,r,t) * ao(i,r,t))
            + sum(j,PROD_COMM, VVA(j,r,t) * ava(j,r,t))
            + sum(j,PROD_COMM, sum(i,ENDW_COMM, VFA(i,j,r,t) * afe(i,j,r,t)))
            + sum(j,PROD_COMM, sum(i,TRAD_COMM, VFA(i,j,r,t) * af(i,j,r,t)))
            + sum(m,MARG_COMM, sum(i,TRAD_COMM, sum(s,REG,
                VTMFSD(m,i,s,r,t) * atmfsd(m,i,s,r,t))))
            + sum(i,TRAD_COMM, sum(s,REG, VIMS(i,s,r,t) * ams(i,s,r,t)))
            + sum(i,TRAD_COMM, sum(s,REG, VXWD(i,r,s,t) * pfob(i,r,s,t)))
            + sum(m,MARG_COMM, VST(m,r,t) * pm(m,r,t))
            + NETINV(r,t) * pcgds(r,t)
            - sum(i,TRAD_COMM, sum(s,REG, VXWD(i,s,r,t) * pfob(i,s,r,t)))
            - sum(m,MARG_COMM, VTMD(m,r,t) * pt(m,t))
            - SAVE(r,t) * psave(r,t)]
        + 0.01 * INCOMEEV(r,t) * pop(r,t);

Variable (linear,change)(all,t,ALLTIME)
    WEV_ALT(t) # expression for WEV computed in alternative way #;
Equation WORLDEV
# Equivalent Variation for the world #
(all,t,ALLTIME)
    WEV_ALT(t) = sum(r,REG, EV_ALT(r,t));

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTdpar(r,t) # contribution to EV of change in distribution parameters #;
Equation CNT_WEV_dpar
(all,r,REG)(all,t,ALLTIME)
    CNTdpar(r,t)
        = -0.01 * UTILELASEV(r,t) * INCOMEEV(r,t)
        * [DPARPRIV(r,t) * loge(UTILPRIVEV(r,t) / UTILPRIV(r,t)) * dppriv(r,t)
            + DPARGOV(r,t) * loge(UTILGOVEV(r,t) / UTILGOV(r,t)) * dpgov(r,t)
            + DPARSAVE(r,t)*loge(UTILSAVEEV(r,t)/UTILSAVE(r,t)) * dpsave(r,t)];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTpopr(r,t) # contribution to EV in region r of change in population #;
Equation CONT_EV_pop
(all,r,REG)(all,t,ALLTIME)
    CNTpopr(r,t) = 0.01 * INCOMEEV(r,t) * pop(r,t);

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTqor(r,t) # contribution to EV in region r of output changes #;
Equation CONT_EV_qor
(all,r,REG)(all,t,ALLTIME)
    CNTqor(r,t)
        = sum(i,NSAV_COMM,
            0.01 * EVSCALFACT(r,t) * PTAX(i,r,t) * [qo(i,r,t) - pop(r,t)]);

Variable (linear,change)(all,i,NSAV_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqoir(i,r,t) # contribution to EV of changes in output of NSAV_COMM i in reg. r #;
Equation CONT_EV_qoir
(all,i,NSAV_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqoir(i,r,t) = PTAX(i,r,t)*[0.01*EVSCALFACT(r,t)]*[qo(i,r,t) - pop(r,t)];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTqfer(r,t) # cont. to EV of changes in use of all ENDW_COMM in all ind. in reg. r #;
Equation CONT_EV_qfer
(all,r,REG)(all,t,ALLTIME)
    CNTqfer(r,t)
        = sum(i,ENDW_COMM, sum(j,PROD_COMM,
            ETAX(i,j,r,t)*[0.01*EVSCALFACT(r,t)]*[qfe(i,j,r,t) - pop(r,t)]));

Variable (linear,change)(all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfeir(i,r,t) # contribution to EV of changes in use of ENDW_COMM i in all ind. in r #;
Equation CONT_EV_qfeir
(all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfeir(i,r,t)
        = sum(j,PROD_COMM,
            ETAX(i,j,r,t)*[0.01*EVSCALFACT(r,t)]*[qfe(i,j,r,t) - pop(r,t)]);

Variable (linear,change)(all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfeijr(i,j,r,t) # cont. to EV of changes in use of ENDW_COMM i in ind. j of reg. r #;
Equation CONT_EV_qfeijr
(all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfeijr(i,j,r,t)
        = ETAX(i,j,r,t) * [0.01 * EVSCALFACT(r,t)] * [qfe(i,j,r,t) - pop(r,t)];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTqfmr(r,t) # cont. to EV of changes in use of imported int. in all ind. in reg. r #;
Equation CONT_EV_qfmr
(all,r,REG)(all,t,ALLTIME)
    CNTqfmr(r,t)
        = sum(i,TRAD_COMM, sum(j,PROD_COMM,
            IFTAX(i,j,r,t)*[0.01*EVSCALFACT(r,t)]*[qfm(i,j,r,t)-pop(r,t)]));

Variable (linear,change)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfmir(i,r,t) # cont. to EV of changes in use of imported int. i in all ind. in r #;
Equation CONT_EV_qfmir
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfmir(i,r,t)
        = sum(j,PROD_COMM,
            IFTAX(i,j,r,t)*[0.01*EVSCALFACT(r,t)]*[qfm(i,j,r,t)-pop(r,t)]);

Variable (linear,change)(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfmijr(i,j,r,t) # cont. to EV of changes in use of imported int. i in ind. j of reg. r #;
Equation CONT_EV_qfmijr
(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfmijr(i,j,r,t)
        = IFTAX(i,j,r,t) * [0.01 * EVSCALFACT(r,t)] * [qfm(i,j,r,t) - pop(r,t)];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTqfdr(r,t) # cont. to EV of changes in use of domestic int. in all ind. in reg. r #;
Equation CONT_EV_qfdr
(all,r,REG)(all,t,ALLTIME)
    CNTqfdr(r,t)
        = sum(i,TRAD_COMM, sum(j,PROD_COMM,
            DFTAX(i,j,r,t)*[0.01*EVSCALFACT(r,t)]*[qfd(i,j,r,t)-pop(r,t)]));

Variable (linear,change)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfdir(i,r,t) # contribution to EV of changes in use of domestic i in all ind. in r #;
Equation CONT_EV_qfdir
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfdir(i,r,t)
        = sum(j,PROD_COMM,
            DFTAX(i,j,r,t)*[0.01*EVSCALFACT(r,t)]*[qfd(i,j,r,t)-pop(r,t)]);

Variable (linear,change)(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfdijr(i,j,r,t) # cont. to EV of changes in use of domestic int. i in ind. j of reg. r #;
Equation CONT_EV_qfdijr
(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqfdijr(i,j,r,t)
        = DFTAX(i,j,r,t) * [0.01 * EVSCALFACT(r,t)] * [qfd(i,j,r,t) - pop(r,t)];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTqpmr(r,t) # contribution to EV of changes in consumption of imported goods in r #;
Equation CONT_EV_qpmr
(all,r,REG)(all,t,ALLTIME)
    CNTqpmr(r,t)
        = sum(i,TRAD_COMM,
            IPTAX(i,r,t) * [0.01 * EVSCALFACT(r,t)] * [qpm(i,r,t) - pop(r,t)]);

Variable (linear,change)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqpmir(i,r,t) # cont. to EV of changes in consumption of imported good i in reg. r #;
Equation CONT_EV_qpmir
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqpmir(i,r,t)=IPTAX(i,r,t)*[0.01*EVSCALFACT(r,t)]*[qpm(i,r,t)-pop(r,t)];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTqpdr(r,t) # contribution to EV of changes in consumption of domestic goods in r #;
Equation CONT_EV_qpdr
(all,r,REG)(all,t,ALLTIME)
    CNTqpdr(r,t)
        = sum(i,TRAD_COMM,
            DPTAX(i,r,t) * [0.01 * EVSCALFACT(r,t)] * [qpd(i,r,t) - pop(r,t)]);

Variable (linear,change)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqpdir(i,r,t) # cont. to EV of changes in consumption of domestic good i in reg. r #;
Equation CONT_EV_qpdir
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqpdir(i,r,t) = DPTAX(i,r,t)*[0.01*EVSCALFACT(r,t)]*[qpd(i,r,t)-pop(r,t)];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTqgmr(r,t) # cont. to EV of changes in gov't consumption of imports in reg. r #;
Equation CONT_EV_qgmr
(all,r,REG)(all,t,ALLTIME)
    CNTqgmr(r,t)
        = sum(i,TRAD_COMM,
            IGTAX(i,r,t) * [0.01 * EVSCALFACT(r,t)] * [qgm(i,r,t) - pop(r,t)]);

Variable (linear,change)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqgmir(i,r,t) # cont. to EV of changes in gov't consumption of import i in reg. r #;
Equation CONT_EV_qgmir
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqgmir(i,r,t) = IGTAX(i,r,t)*[0.01*EVSCALFACT(r,t)]*[qgm(i,r,t)-pop(r,t)];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTqgdr(r,t) # cont. to EV of changes in gov't consumption of domestics in reg. r #;
Equation CONT_EV_qgdr
(all,r,REG)(all,t,ALLTIME)
    CNTqgdr(r,t)
        = sum(i,TRAD_COMM,
            DGTAX(i,r,t) * [0.01 * EVSCALFACT(r,t)] * [qgd(i,r,t) - pop(r,t)]);

Variable (linear,change)(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqgdir(i,r,t) # cont. to EV of changes in gov't consumption of domestic i in reg. r #;
Equation CONT_EV_qgdir
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTqgdir(i,r,t) = DGTAX(i,r,t)*[0.01*EVSCALFACT(r,t)]*[qgd(i,r,t)-pop(r,t)];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTqxsr(r,t) # cont. to EV of changes in exports of all goods from SRCE r to all DEST #;
Equation CONT_EV_qxsr
(all,r,REG)(all,t,ALLTIME)
    CNTqxsr(r,t)
        = sum(i,TRAD_COMM, sum(s,REG,
            XTAXD(i,r,s,t)*[0.01*EVSCALFACT(r,t)]*[qxs(i,r,s,t)-pop(r,t)]));

Variable (linear,change)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    CNTqxsirs(i,r,s,t) # cont. to EV of changes in exports of i from SRCE r to DEST s #;
Equation CONT_EV_qxsirs
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    CNTqxsirs(i,r,s,t)
        = XTAXD(i,r,s,t) * [0.01 * EVSCALFACT(r,t)] * [qxs(i,r,s,t) - pop(r,t)];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTqimr(r,t) # cont. to EV of changes in imports of all goods from all SRCE to DEST r #;
Equation CONT_EV_qimr
(all,r,REG)(all,t,ALLTIME)
    CNTqimr(r,t)
        = sum(i,TRAD_COMM, sum(s,REG,
            MTAX(i,s,r,t)*[0.01*EVSCALFACT(r,t)]*[qxs(i,s,r,t)-pop(r,t)]));

Variable (linear,change)(all,i,TRAD_COMM)(all,s,REG)(all,r,REG)(all,t,ALLTIME)
    CNTqimisr(i,s,r,t) # cont. to EV of changes in imports of i from SRCE s to DEST r #;
Equation CONT_EV_qimisr
(all,i,TRAD_COMM)(all,s,REG)(all,r,REG)(all,t,ALLTIME)
    CNTqimisr(i,s,r,t)
        = MTAX(i,s,r,t) * [0.01 * EVSCALFACT(r,t)] * [qxs(i,s,r,t) - pop(r,t)];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTalleffr(r,t) # total contribution to regional EV of allocative effects #;
Equation CONT_EV_alleffr
(all,r,REG)(all,t,ALLTIME)
    CNTalleffr(r,t)
        = [0.01 * EVSCALFACT(r,t)]
        * [sum(i,NSAV_COMM, PTAX(i,r,t) * [qo(i,r,t) - pop(r,t)])
            + sum(i,ENDW_COMM, sum(j,PROD_COMM,
                ETAX(i,j,r,t) * [qfe(i,j,r,t) - pop(r,t)]))
            + sum(i,TRAD_COMM, sum(j,PROD_COMM,
                IFTAX(i,j,r,t) * [qfm(i,j,r,t) - pop(r,t)]))
            + sum(i,TRAD_COMM, sum(j,PROD_COMM,
                DFTAX(i,j,r,t) * [qfd(i,j,r,t) - pop(r,t)]))
            + sum(i,TRAD_COMM, IPTAX(i,r,t) * [qpm(i,r,t) - pop(r,t)])
            + sum(i,TRAD_COMM, DPTAX(i,r,t) * [qpd(i,r,t) - pop(r,t)])
            + sum(i,TRAD_COMM, IGTAX(i,r,t) * [qgm(i,r,t) - pop(r,t)])
            + sum(i,TRAD_COMM, DGTAX(i,r,t) * [qgd(i,r,t) - pop(r,t)])
            + sum(i,TRAD_COMM,sum(s,REG,XTAXD(i,r,s,t)*[qxs(i,r,s,t)-pop(r,t)]))
            + sum(i,TRAD_COMM, sum(s,REG,
                MTAX(i,s,r,t) * [qxs(i,s,r,t) - pop(r,t)]))];

Variable (linear,change)(all,i,DEMD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTalleffir(i,r,t) # total contribution to regional EV of allocative effects #;
Equation CONT_EV_alleffir_E
(all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTalleffir(i,r,t)
        = [0.01 * EVSCALFACT(r,t)]
        * [PTAX(i,r,t) * [qo(i,r,t) - pop(r,t)]
            + sum(j,PROD_COMM, ETAX(i,j,r,t) * [qfe(i,j,r,t) - pop(r,t)])];
Equation CONT_EV_alleffir_T
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTalleffir(i,r,t)
        = [0.01 * EVSCALFACT(r,t)]
        * [PTAX(i,r,t) * [qo(i,r,t) - pop(r,t)]
            + sum(j,PROD_COMM, IFTAX(i,j,r,t) * [qfm(i,j,r,t) - pop(r,t)])
            + sum(j,PROD_COMM, DFTAX(i,j,r,t) * [qfd(i,j,r,t) - pop(r,t)])
            + IPTAX(i,r,t) * [qpm(i,r,t) - pop(r,t)]
            + DPTAX(i,r,t) * [qpd(i,r,t) - pop(r,t)]
            + IGTAX(i,r,t) * [qgm(i,r,t) - pop(r,t)]
            + DGTAX(i,r,t) * [qgd(i,r,t) - pop(r,t)]
            + sum(s,REG, XTAXD(i,r,s,t) * [qxs(i,r,s,t) - pop(r,t)])
            + sum(s,REG, MTAX(i,s,r,t) * [qxs(i,s,r,t) - pop(r,t)])];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTtotr(r,t) # contribution to regional EV of changes in its terms of trade #;
Equation CONT_EV_totr
(all,r,REG)(all,t,ALLTIME)
    CNTtotr(r,t)
        = [0.01 * EVSCALFACT(r,t)]
        * [sum(i,TRAD_COMM,sum(s,REG,VXWD(i,r,s,t)*[pfob(i,r,s,t)-pxwwld(t)]))
           + sum(m,MARG_COMM, VST(m,r,t) * [pm(m,r,t) - pxwwld(t)])
           - sum(i,TRAD_COMM,sum(s,REG,VXWD(i,s,r,t)*[pfob(i,s,r,t)-pxwwld(t)]))
           - sum(m,MARG_COMM, VTMD(m,r,t) * [pt(m,t) - pxwwld(t)])];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTcgdsr(r,t) #contribution to regional EV of changes in the price of cgds#;
Equation CNT_EV_cgdsr
(all,r,REG)(all,t,ALLTIME)
    CNTcgdsr(r,t)
        = [0.01 * EVSCALFACT(r,t)]
        * [NETINV(r,t)*[pcgds(r,t)-pxwwld(t)]-SAVE(r,t)*[psave(r,t)-pxwwld(t)]];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTendwr(r,t) # contribution to regional EV of changes in all ENDW_COMM #;
Equation CONT_EV_endwr
(all,r,REG)(all,t,ALLTIME)
    CNTendwr(r,t)
        = [0.01 * EVSCALFACT(r,t)]
        * [sum(i,ENDW_COMM, VOA(i,r,t) * [qo(i,r,t) - pop(r,t)])
            - VDEP(r,t) * [qo("capital",r,t) - pop(r,t)]];

Variable (linear,change)(all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTendwir(i,r,t) # contribution to regional EV of changes in ENDW_COMM i #;
Equation CONT_EV_endwir
(all,i,ENDW_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTendwir(i,r,t) = [0.01*EVSCALFACT(r,t)]*[VOA(i,r,t)*[qo(i,r,t)-pop(r,t)]];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTtechr(r,t) # contribution to regional EV of all technical change #;
Equation CONT_EV_techr
(all,r,REG)(all,t,ALLTIME)
    CNTtechr(r,t)
        = [0.01 * EVSCALFACT(r,t)]
        * [sum(i,PROD_COMM, VOA(i,r,t) * ao(i,r,t))
            + sum(j,PROD_COMM, sum(i,ENDW_COMM, VFA(i,j,r,t) * afe(i,j,r,t)))
            + sum(j,PROD_COMM, VVA(j,r,t) * ava(j,r,t))
            + sum(j,PROD_COMM, sum(i,TRAD_COMM,
                [VIFA(i,j,r,t) + VDFA(i,j,r,t)] * af(i,j,r,t)))
            + sum(m,MARG_COMM, sum(i,TRAD_COMM, sum(s,REG,
                VTMFSD(m,i,s,r,t) * atmfsd(m,i,s,r,t))))
            + sum(i,TRAD_COMM, sum(s,REG, VIMS(i,s,r,t) * ams(i,s,r,t)))];

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTtech_aor(r,t) # contribution to regional EV of output augmenting technical change #;
Equation CONT_EV_tech_aor
(all,r,REG)(all,t,ALLTIME)
    CNTtech_aor(r,t)
        = [0.01 * EVSCALFACT(r,t)] * sum(i,PROD_COMM, VOA(i,r,t) * ao(i,r,t));

Variable (linear,change)(all,i,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTtech_aoir(i,r,t) # cont. to regional EV of output augmenting tech change in TRAD_COMM i #;
Equation CONT_EV_tech_aoir
(all,i,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTtech_aoir(i,r,t) = [0.01 * EVSCALFACT(r,t)] * VOA(i,r,t) * ao(i,r,t);

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTtech_afer(r,t) # contribution to regional EV of primary factor augmenting tech change #;
Equation CONT_EV_tech_afer
(all,r,REG)(all,t,ALLTIME)
    CNTtech_afer(r,t)
        = [0.01 * EVSCALFACT(r,t)]
        * sum(j,PROD_COMM, sum(i,ENDW_COMM, VFA(i,j,r,t) * afe(i,j,r,t)));

Variable (linear,change)(all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTtech_afeijr(i,j,r,t) # cont. to EV of primary factor i augmenting tech change in sector j #;
Equation CONT_EV_tech_afeijr
(all,i,ENDW_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTtech_afeijr(i,j,r,t) = [0.01*EVSCALFACT(r,t)]*VFA(i,j,r,t)*afe(i,j,r,t);

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTtech_avar(r,t) # contribution to regional EV of value added augmenting tech change #;
Equation CONT_EV_tech_avar
(all,r,REG)(all,t,ALLTIME)
    CNTtech_avar(r,t)
        = [0.01 * EVSCALFACT(r,t)] * sum(j,PROD_COMM, VVA(j,r,t) * ava(j,r,t));

Variable (linear,change)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTtech_avajr(j,r,t) # cont. to EV of value added augmenting tech change in sector j #;
Equation CONT_EV_tech_avajr
(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTtech_avajr(j,r,t) = [0.01 * EVSCALFACT(r,t)] * VVA(j,r,t) * ava(j,r,t);

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTtech_afr(r,t) # cont. to regional EV of comp. int. input augmenting tech change #;
Equation CONT_EV_tech_afr
(all,r,REG)(all,t,ALLTIME)
    CNTtech_afr(r,t)
        = [0.01 * EVSCALFACT(r,t)]
        * sum(j,PROD_COMM, sum(i,TRAD_COMM,
            [VIFA(i,j,r,t) + VDFA(i,j,r,t)] * af(i,j,r,t)));

Variable (linear,change)(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTtech_afijr(i,j,r,t) # cont. to EV of composite i input augmenting tech change in sector j #;
Equation CONT_EV_tech_afijr
(all,i,TRAD_COMM)(all,j,PROD_COMM)(all,r,REG)(all,t,ALLTIME)
    CNTtech_afijr(i,j,r,t)
        = [0.01*EVSCALFACT(r,t)]*[VIFA(i,j,r,t)+VDFA(i,j,r,t)]*af(i,j,r,t);

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTtech_atrr(r,t) # contribution to regional EV of technical change in transportation #;
Equation CONT_EV_tech_atrr
(all,r,REG)(all,t,ALLTIME)
    CNTtech_atrr(r,t)
        = [0.01 * EVSCALFACT(r,t)]
        * sum(m,MARG_COMM, sum(i,TRAD_COMM, sum(s,REG,
            VTMFSD(m,i,s,r,t) * atmfsd(m,i,s,r,t))));

Variable (linear,change)(all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    CNTtech_afmfdsd(m,i,r,s,t) # cont. to EV of tech change in transportation efficiency #;
Equation CONT_EV_tech_afmfdsd
(all,m,MARG_COMM)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    CNTtech_afmfdsd(m,i,r,s,t)
        = [0.01 * EVSCALFACT(s,t)] * VTMFSD(m,i,r,s,t) * atmfsd(m,i,r,s,t);

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTtech_amsr(r,t) #cont. to EV of bilateral import-augmenting tech change#;
Equation CONT_EV_tech_amsr
(all,r,REG)(all,t,ALLTIME)
    CNTtech_amsr(r,t)
        = [0.01 * EVSCALFACT(r,t)]
        * sum(i,TRAD_COMM, sum(s,REG, VIMS(i,s,r,t) * ams(i,s,r,t)));

Variable (linear,change)(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    CNTtech_amsirs(i,r,s,t) # cont. to EV of bilateral import augmenting tech change for TRAD_COMM i #;
Equation CONT_EV_tech_amsirs
(all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    CNTtech_amsirs(i,r,s,t) = [0.01*EVSCALFACT(r,t)]*VIMS(i,r,s,t)*ams(i,r,s,t);

Variable (linear,change)(all,r,REG)(all,t,ALLTIME)
    CNTkbr(r,t) # cont. to EV of changes to beg. period capital stock and depreciation #;
Equation CONT_EV_kbr
(all,r,REG)(all,t,ALLTIME)
    CNTkbr(r,t)= -[0.01*EVSCALFACT(r,t)]*VDEP(r,t)*[qo("capital",r,t)-pop(r,t)];


!<
    -------------------------------
    D. Terms of Trade Decomposition
    -------------------------------

    Computations for decomposition the terms-of-trade effect
    Reference: Robert McDougall, SALTER No. 12 Working Paper
>!

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SX_IR(i,r,t) # share of good i in total exports from r #;
Formula (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    SX_IR(m,r,t)
        = [sum(s,REG, VXWD(m,r,s,t)) + VST(m,r,t)]
        / [sum(k,TRAD_COMM, sum(s,REG, VXWD(k,r,s,t)))
            + sum(l,MARG_COMM, VST(l,r,t))];
Formula (all,i,NMRG_COMM)(all,r,REG)(all,t,ALLTIME)
    SX_IR(i,r,t)
        = sum(s,REG, VXWD(i,r,s,t))
        / [sum(k,TRAD_COMM, sum(s,REG, VXWD(k,r,s,t)))
            + sum(l,MARG_COMM, VST(l,r,t))];

Coefficient (all,m,MARG_COMM)(all,s,REG)(all,t,ALLTIME)
    VTICOMM(m,s,t) # margin usage of m in getting imports to region s #;
Formula (all,m,MARG_COMM)(all,s,REG)(all,t,ALLTIME)
    VTICOMM(m,s,t) = sum(i,TRAD_COMM, sum(r,REG, VTMFSD(m,i,r,s,t)));

Coefficient (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    VIWDIRALL(i,s,t) # imports of i into s, with direct allocation of margins #;
Formula (all,m,MARG_COMM)(all,s,REG)(all,t,ALLTIME)
    VIWDIRALL(m,s,t) = sum(r,REG, VXWD(m,r,s,t)) + VTICOMM(m,s,t);
Formula (all,i,NMRG_COMM)(all,s,REG)(all,t,ALLTIME)
    VIWDIRALL(i,s,t) = sum(r,REG, VXWD(i,r,s,t));

Coefficient (all,s,REG)(all,t,ALLTIME)
    VIWDATOT(s,t) #total imports into s, calculated on direct allocation basis#;
Formula (all,s,REG)(all,t,ALLTIME)
    VIWDATOT(s,t) = sum(i,TRAD_COMM, VIWDIRALL(i,s,t));

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SM_IR(i,r,t)  # share of good i in total imports into r #;
Formula (all,i,TRAD_COMM)(all,s,REG)(all,t,ALLTIME)
    SM_IR(i,s,t) = VIWDIRALL(i,s,t) / VIWDATOT(s,t);

Zerodivide (zero_by_zero) default 0;
Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    SX_IRS(i,r,s,t) # share of exports of good i from region r to s #;
Formula (all,m,MARG_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    SX_IRS(m,r,s,t) = VXWD(m,r,s,t) / [sum(k,REG, VXWD(m,r,k,t)) + VST(m,r,t)];
Formula (all,i,NMRG_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    SX_IRS(i,r,s,t) = VXWD(i,r,s,t) / sum(k,REG, VXWD(i,r,k,t));
Zerodivide (zero_by_zero) off;

Coefficient (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    SXT_IR(m,r,t) # share of margins in exports of good i from region r #;
Formula (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    SXT_IR(m,r,t) = VST(m,r,t) / [sum(k,REG, VXWD(m,r,k,t)) + VST(m,r,t)];

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    px_ir(i,r,t) # export price index for good i and region r #;
Equation EXPPRICE_MARG
# price index for total exports of m from r #
(all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    px_ir(m,r,t)
        = sum(s,REG, SX_IRS(m,r,s,t)*pfob(m,r,s,t)) + SXT_IR(m,r,t)*pm(m,r,t);
Equation EXPPRICE_NMRG
# price index for total exports of i from r #
(all,i,NMRG_COMM)(all,r,REG)(all,t,ALLTIME)
    px_ir(i,r,t) = sum(s,REG, SX_IRS(i,r,s,t) * pfob(i,r,s,t));

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    SM_IRS(i,r,s,t) # share of imports of good i into s from r at FOB prices #;
Formula (all,i,TRAD_COMM)(all,r,REG)(all,s,REG)(all,t,ALLTIME)
    SM_IRS(i,r,s,t) = VXWD(i,r,s,t) / VIWDIRALL(i,s,t);

Coefficient (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    SMT_IR(m,r,t) # share of transport cost in imports of margin commodity #;
Formula (all,m,MARG_COMM)(all,s,REG)(all,t,ALLTIME)
    SMT_IR(m,s,t) = VTICOMM(m,s,t) / VIWDIRALL(m,s,t);

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    pm_ir(i,r,t) # imports price index for good i and region r #;
Equation IMPPRICE1_MARG
# price index for total imports of m in s -- margins commodities #
(all,m,MARG_COMM)(all,s,REG)(all,t,ALLTIME)
    pm_ir(m,s,t)
        = sum(r,REG, SM_IRS(m,r,s,t) * pfob(m,r,s,t)) + SMT_IR(m,s,t) * pt(m,t);
Equation IMPPRICE1_NMRG
# price index for total imports of i in s -- non-margins commodities #
(all,i,NMRG_COMM)(all,s,REG)(all,t,ALLTIME)
    pm_ir(i,s,t) = sum(r,REG, SM_IRS(i,r,s,t) * pfob(i,r,s,t));

Coefficient (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    SW_IR(i,r,t) # share of region r exports in world total for good i #;
Formula (all,m,MARG_COMM)(all,r,REG)(all,t,ALLTIME)
    SW_IR(m,r,t)
        = [sum(s,REG, VXWD(m,r,s,t)) + VST(m,r,t)]
        / sum(k,REG, sum(s,REG, VXWD(m,k,s,t)) + VST(m,k,t));
Formula (all,i,NMRG_COMM)(all,r,REG)(all,t,ALLTIME)
    SW_IR(i,r,t)
        = sum(s,REG, VXWD(i,r,s,t)) / sum(k,REG, sum(s,REG, VXWD(i,k,s,t)));

Variable (all,i,TRAD_COMM)(all,t,ALLTIME)
    px_i(i,t) # world export price index for commodity i #;
Equation WRLDPRICEi
# world export price index for good i #
(all,i,TRAD_COMM)(all,t,ALLTIME)
    px_i(i,t) = sum(r,REG, SW_IR(i,r,t) * px_ir(i,r,t));

Coefficient (all,i,TRAD_COMM)(all,t,ALLTIME)
    SW_I(i,t) # share of exports of i in world total #;
Formula (all,m,MARG_COMM)(all,t,ALLTIME)
    SW_I(m,t)
        = sum(r,REG, sum(s,REG, VXWD(m,r,s,t)) + VST(m,r,t))
        / [sum(k,TRAD_COMM, sum(r,REG, sum(s,REG, VXWD(k,r,s,t))))
            + sum(l,MARG_COMM, sum(r,REG, VST(l,r,t)))];
Formula (all,i,NMRG_COMM)(all,t,ALLTIME)
    SW_I(i,t)
        = sum(r,REG, sum(s,REG, VXWD(i,r,s,t)))
        / [sum(k,TRAD_COMM, sum(r,REG, sum(s,REG, VXWD(k,r,s,t))))
            + sum(l,MARG_COMM, sum(r,REG, VST(l,r,t)))];

Variable (all,t,ALLTIME)
    px_(t) # world export price index for all commodities #;
Equation WRLDPRICE
# world export price index for all goods #
(all,t,ALLTIME)
    px_(t) = sum(i,TRAD_COMM, SW_I(i,t) * px_i(i,t));

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    c1_ir(i,r,t) # contribution of world price, px_i, to ToT #;
Equation c1_irEQ
# contribution of world export price index of good i to ToT for region r #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    c1_ir(i,r,t) = [SX_IR(i,r,t) - SM_IR(i,r,t)] * [px_i(i,t) - px_(t)];

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    c2_ir(i,r,t) # contribution of regional export price, px_ir, to ToT #;
Equation c2_irEQ
# contribution of regional export price of good i for region r #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    c2_ir(i,r,t) = SX_IR(i,r,t) * [px_ir(i,r,t) - px_i(i,t)];

Variable (all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    c3_ir(i,r,t) # contribution of regional import price, pm_ir, to ToT #;
Equation c3_irEQ
# contribution of imports price index of good i for region r #
(all,i,TRAD_COMM)(all,r,REG)(all,t,ALLTIME)
    c3_ir(i,r,t) = SM_IR(i,r,t) * [pm_ir(i,r,t) - px_i(i,t)];

Variable (all,r,REG)(all,t,ALLTIME)
    c1_r(r,t) # contribution of world prices for all goods to ToT #;
Equation c1_rEQ
# contribution of world price indexes of all goods to ToT for r #
(all,r,REG)(all,t,ALLTIME)
    c1_r(r,t) = sum(i,TRAD_COMM, c1_ir(i,r,t));

Variable (all,r,REG)(all,t,ALLTIME)
    c2_r(r,t) # contribution of regional export prices to ToT #;
Equation c2_rEQ
# contribution of regional exports prices to ToT for r #
(all,r,REG)(all,t,ALLTIME)
    c2_r(r,t) = sum(i,TRAD_COMM, c2_ir(i,r,t));

Variable (all,r,REG)(all,t,ALLTIME)
    c3_r(r,t) # contribution of regional import prices to ToT #;
Equation c3_rEQ
# contribution of regional import prices to ToT for r #
(all,r,REG)(all,t,ALLTIME)
    c3_r(r,t) = sum(i,TRAD_COMM, c3_ir(i,r,t));

Variable (all,r,REG)(all,t,ALLTIME)
    tot2(r,t) # trade terms for region r, computed from components #;
Equation TOT2eq
# trade terms for region r, computed from components #
(all,r,REG)(all,t,ALLTIME)
    tot2(r,t) = c1_r(r,t) + c2_r(r,t) - c3_r(r,t);

!<
Intertemporal module
>!

!<
    -------------------------------
    E. Intertemporal module
    -------------------------------

>!

Variable (all,r,REG)(all,t,ALLTIME)
    mu(r,t) # capital shadow price #;
Variable (all,r,REG)(all,t,ALLTIME)
    capital(r,t) # capital stock #;
Variable (all,r,REG)(all,t,ALLTIME)
    capincr(r,t) # increase in capital stock #;
Variable (all,r,REG)(all,t,FWDTIME)
    delCap(r,t) # dummy variable to calibrate steady state capital value#;
Variable (all,r,REG)(all,t,ALLTIME)
    delMu(r,t) # Dummy variable to calibrate steady state capital value#;


Coefficient (all,r,REG)(all,t,ALLTIME)
    VMU(r,t) # shadow price of capital #;
Coefficient (all,r,REG)(all,t,ALLTIME)
    VCAPINCR(r,t) # value of real capital increment #;
Coefficient (all,r,REG)(all,t,ALLTIME)
    LCAPPRC(r,t) # value of capital price #;
Coefficient (all,r,REG)(all,t,ALLTIME)
    LINVPRC(r,t) # value of investment price #;
Coefficient (all,r,REG)(all,t,ALLTIME)
    MUSHR(r,t) # mu share coefficient #;
Coefficient (all,r,REG)(all,t,ALLTIME)
    PCAPSHR(r,t) # capital price component share coefficient #;
Coefficient (all,r,REG)(all,t,ALLTIME)
    MUSUM(r,t) # sum of RHS mu motion equation #;
Coefficient (all,r,REG)(all,t,FWDTIME)
    CAPISHR(r,t) # qo cgds share coefficient #;
Coefficient (all,r,REG)(all,t,FWDTIME)
    LCAPHAT(r,t) # capital shadow price #;
Coefficient (all,r,REG)(all,t,ALLTIME)
    LMUHAT(r,t) # MU slack coefficient #;

!Initial condition switching mechanism: If INIDELTA=1, VKB and the value
of ps("capital",r,t) will be adjusted so the current base year data will become
steady state of the economy. When INIDELTA=0, VKB will be read from data and
the value of ps("capital",r,t) will be calculated by definition. The values of
the auxiliary variables - LCAPHAT(r,t) and LMUHAT(r,t) - should be one. If they
are not 1 then shock them to 1 to get the baseline scenario!

Coefficient (integer,parameter)
    INIDELTA # binary coefficient to switch mechanism of initial condition #;
Formula
    INIDELTA = 0;

Coefficient (parameter)(all,r,REG)(all,t,ALLTIME)
    CPHI(r,t) # investment parameter #;
Formula (all,r,REG)(all,t,ALLTIME)
    CPHI(r,t) = 0.1;

Coefficient (parameter)(all,r,REG)(all,t,ALLTIME)
    KAPPA(r,t) # depreciation rate #;
Formula (all,r,REG)(all,t,ALLTIME)
    KAPPA(r,t) = 0.08;

Coefficient (all,t,ALLTIME)
    LRORG(t) # value of global interest rate #;
Formula (all,t,ALLTIME)
    LRORG(t) = 0.04;

Formula (all,r,REG)(all,t,ALLTIME)
    LINVPRC(r,t) = 1; !Normalised value of ps("cgds",r,t)!
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    VCAPINCR(r,t) = INIDELTA * VOA("cgds",r,t) / [1 + CPHI(r,t) * KAPPA(r,t) / 2]
                    + [1 - INIDELTA] * [(VKB(r,t)^2 + 2 * CPHI(r,t) * VKB(r,t) * VOA("cgds",r,t))^0.5 - VKB(r,t)] / CPHI(r,t);
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    VKB(r,t) = INIDELTA * VCAPINCR(r,t) / KAPPA(r,t) + [1 - INIDELTA] * VKB(r,t);
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    VMU(r,t) = [1 + CPHI(r,t) * VCAPINCR(r,t) / VKB(r,t)] * LINVPRC(r,t);
Formula (initial)(all,r,REG)(all,t,ALLTIME)
    LCAPPRC(r,t) = INIDELTA * [VMU(r,t) * (LRORG(t) + KAPPA(r,t)) - CPHI(r,t) * KAPPA(r,t)^2 / 2 * LINVPRC(r,t)]
                    + [1 - INIDELTA] * EVOA("capital",r,t) / VKB(r,t);
Formula (all,r,REG)(all,t,FWDTIME)
    MUSUM(r,t) = VMU(r,t) * ((LRORG(t) + KAPPA(r,t)) * (YEAR(t+1) - YEAR(t)) + 1)
                 - CPHI(r,t) * [VCAPINCR(r,t) / VKB(r,t)]^2 / 2 * LINVPRC(r,t) * (YEAR(t+1) - YEAR(t))
                 - LCAPPRC(r,t) * (YEAR(t+1) - YEAR(t));
Formula (all,r,REG)(all,t,ENDTIME)
    MUSUM(r,t) = VMU(r,t) * ((LRORG(t) + KAPPA(r,t)) * (YEAR(t) - YEAR(t-1)) + 1)
                 - CPHI(r,t) * [VCAPINCR(r,t) / VKB(r,t)]^2 / 2 * LINVPRC(r,t) * (YEAR(t) - YEAR(t-1))
                 - LCAPPRC(r,t) * (YEAR(t) - YEAR(t-1));
Formula (all,r,REG)(all,t,FWDTIME)
    MUSHR(r,t) = VMU(r,t) * ((LRORG(t) + KAPPA(r,t)) * (YEAR(t+1) - YEAR(t)) + 1) / MUSUM(r,t);
Formula (all,r,REG)(all,t,ENDTIME)
    MUSHR(r,t) = VMU(r,t) * ((LRORG(t) + KAPPA(r,t)) * (YEAR(t) - YEAR(t-1)) + 1) / MUSUM(r,t);
Formula (all,r,REG)(all,t,FWDTIME)
    PCAPSHR(r,t) = -LCAPPRC(r,t) * (YEAR(t+1) - YEAR(t)) / MUSUM(r,t);
Formula (all,r,REG)(all,t,ENDTIME)
    PCAPSHR(r,t) = -LCAPPRC(r,t) * (YEAR(t) - YEAR(t-1)) / MUSUM(r,t);
Formula (all,r,REG)(all,t,FWDTIME)
    CAPISHR(r,t) = [(YEAR(t+1) - YEAR(t)) * VCAPINCR(r,t)]
                   / [(YEAR(t+1) - YEAR(t)) * VCAPINCR(r,t) + (1 - KAPPA(r,t) * (YEAR(t+1) - YEAR(t))) * VKB(r,t)];
Formula (initial)(all,r,REG)(all,t,FWDTIME)
    LCAPHAT(r,t) = VKB(r,t+1)
                   / [(VCAPINCR(r,t) - KAPPA(r,t) * VKB(r,t)) * (YEAR(t+1) - YEAR(t)) + VKB(r,t)];
Formula (initial)(all,r,REG)(all,t,FWDTIME)
    LMUHAT(r,t) = VMU(r,t+1) / MUSUM(r,t);
Formula (initial)(all,r,REG)(all,t,ENDTIME)
    LMUHAT(r,t) = VMU(r,t) / MUSUM(r,t);

Update (all,r,REG)(all,t,ALLTIME)
    VKB(r,t) = qo("capital",r,t) * ps("cgds",r,t);
Update (all,r,REG)(all,t,ALLTIME)
    VCAPINCR(r,t) = capincr(r,t) * ps("cgds",r,t);
Update (all,r,REG)(all,t,ALLTIME)
    LCAPPRC(r,t) = ps("capital",r,t);
Update (all,r,REG)(all,t,ALLTIME)
    VMU(r,t) = mu(r,t);
Update (all,t,ALLTIME)
    LRORG(t) = rorg(t);
Update (all,r,REG)(all,t,FWDTIME)
    LCAPHAT(r,t) = delCap(r,t);
Update (all,r,REG)(all,t,ALLTIME)
    LMUHAT(r,t) = delMu(r,t);

Equation E_capstock
# capital stock redefinition #
(all,r,REG)(all,t,ALLTIME)
    qo("capital",r,t) = capital(r,t);

Equation E_inv
# investment function #
(all,r,REG)(all,t,ALLTIME)
    qo("cgds",r,t) = capincr(r,t) + CPHI(r,t) * VCAPINCR(r,t)
                      / (2 * VKB(r,t) + CPHI(r,t) * VCAPINCR(r,t)) * (capincr(r,t) - capital(r,t));

Equation E_opti
# FOC #
(all,r,REG)(all,t,ALLTIME)
    ps("cgds",r,t) = mu(r,t) - CPHI(r,t) * VCAPINCR(r,t)
                      / [VKB(r,t) + CPHI(r,t) * VCAPINCR(r,t)] * (capincr(r,t) - capital(r,t));

Equation E_capdot
# capital stock motion equation #
(all,r,REG)(all,t,FWDTIME)
    capital(r,t+1) = CAPISHR(r,t) * capincr(r,t) + [1 - CAPISHR(r,t)] * capital(r,t) + delCap(r,t);

Equation E_mu
# mu motion equation #
(all,r,REG)(all,t,FWDTIME)
    mu(r,t+1) = MUSHR(r,t) * [mu(r,t) + LRORG(t) * (YEAR(t+1) - YEAR(t))
                              / ((LRORG(t) + KAPPA(r,t)) * (YEAR(t+1) - YEAR(t)) + 1) * rorg(t)]
               + [1 - MUSHR(r,t) - PCAPSHR(r,t)] * [ps("cgds",r,t) + 2 * capincr(r,t) - 2 * capital(r,t)]
               + PCAPSHR(r,t) * ps("capital",r,t) + delmu(r,t);

Equation E_mu_end
# ENDTIME mu #
(all,r,REG)(all,t,ENDTIME)
    mu(r,t) = MUSHR(r,t) * [mu(r,t) + LRORG(t) * (YEAR(t) - YEAR(t-1))
                            / ((LRORG(t) + KAPPA(r,t)) * (YEAR(t) - YEAR(t-1)) + 1) * rorg(t)]
              + [1 - MUSHR(r,t) - PCAPSHR(r,t)] * [ps("cgds",r,t) + 2 * capincr(r,t) - 2 * capital(r,t)]
              + PCAPSHR(r,t) * ps("capital",r,t) + delmu(r,t);


!<
    =====================
    END OF GTAP.TAB FILE
    =====================
>!


