help icio                                                                                  
-------------------------------------------------------------------------------------------

Title

    icio --  Economic Analysis with Inter-Country Input-Output tables

Syntax

    Load an ICIO table (required to run icio):

        icio_load, [icio_load_options]

    List of countries and sectors in the loaded ICIO table:

        icio, info

    Supply, final demand and supply-final demand linkages:

        1. Gross Domestic Product:

        icio, origin(country_code[, sector_code]) [standard_options]

        2. Final demand:

        icio, destination(country_code[, sector_code]) [standard_options]

        3. Value-added by origin and final destination:

        icio, origin(country_code[, sector_code]) destination(country_code[,
                sector_code]) [standard_options]

    Value-added decomposition of trade flows and GVC participation:

        1. Value-added and GVC participation in total exports of a country:

            a) Value-added and GVC participation in total aggregate exports:

            icio, exporter(country_code) [methods_1a] [output_exports]
                [origin_destination] [standard_options]

            b) Value-added and GVC participation in total sectoral exports:

            icio, exporter(country_code, sector_code) [methods_1b] [output_exports]
                [origin_destination] [standard_options]

        2. Value-added and GVC participation in bilateral exports:

            a) Value-added and GVC participation in bilateral aggregate exports:

            icio, exporter(country_code) importer(country_code) [methods_2a]
                [output_exports] [origin_destination] [standard_options]

            b) Value-added and GVC participation in bilateral sectoral exports:

            icio, exporter(country_code, sector_code) importer(country_code) [methods_2b]
                [output_exports] [origin_destination] [standard_options]

        3. Value-added in total imports of a country:

            a) Value-added in total aggregate imports:

            icio, importer(country_code) [methods_3a] [output_exports]
                [origin_destination] [standard_options]

            b) Value-added in total sectoral imports:

            icio, importer(country_code, sector_code) [methods_3b] [output_exports]
                [origin_destination] [standard_options]


Description

    icio is suited to measure trade in value-added and participation in GVCs of countries
    and sectors by exploiting Inter-Country Input-Output (ICIO) tables.  It provides
    decompositions of aggregate, bilateral and sectoral exports and imports according to
    the source and the destination of their value-added content.

    The icio_load command allows to work directly with the most popular ICIO tables -
    WIOD (Timmer et al. 2015), TIVA (OECD), EORA (Lenzen et al. 2013); in addition, any
    other user-provided ICIO table can be loaded (see the option user() of icio_load).
    icio also allows to work with user-defined groups of countries, which means that
    output measures can be computed for a country group (e.g. the "Euro area", "MERCOSUR"
    or "ASEAN") as a whole while taking into account the specific supply/demand/trade
    structure of each member of the group (see the option groups() for more details).

    icio encompasses the most relevant measures of value-added in exports and imports at
    different level of aggregation. It follows closely the accounting framework presented
    in Borin and Mancini (2019), which - in turn - extends, refines and reconciles the
    other main contributions in this strand of the literature (Johnson and Noguera, 2012;
    Wang et al., 2013; Koopman et al. 2014; Borin and Mancini, 2015; Los et al., 2016;
    Nagengast and Stehrer, 2016; Johnson, 2018; Miroudot and Ye, 2018; Los and Timmer,
    2018).  A key feature of the conceptual scheme proposed by Borin and Mancini (2019)
    is that different empirical questions call for distinct accounting methods, along
    with different level of aggregation of trade flows. The icio command shares the same
    rationale.

    According to the specific empirical application, the user should select:

        i) a certain type of trade flow (i.e. aggregate exports/imports, sectoral
        exports/imports, bilateral flows, sectoral-bilateral flows), through the options
        exporter(country_code[, sector_code]) and/or importer(country_code[, sector_code]);

        ii) a certain accounting methodology, that can be specified using the perspective()
        and approach() options, otherwise default options are applied.  These accounting
        methodologies differ in the way 'double counted' components are computed, i.e.
        items that are recorded several times in a given gross trade flow due to the
        back-and-forth shipments that occur in a cross-national production process (see
        Borin and Mancini, 2019 and the Example section for a mapping of the questions
        under investigation and the accounting methods needed to address them).

        iii) the desired output measures. The possibility to choose among different output
        measures allows to address a wide range of empirical issues.

    Moreover, origin(country_code[, sector_code]) and destination(country_code[,
    sector_code]) options can always be specified in order to select the country/sector
    where the trade value is produced (origin) and the country/sector where it is
    absorbed by final demand (destination).

    The command allows to reproduce many of the measures of trade in value-added proposed
    in the literature, however they are not computed using the original formulations
    whenever they have been found to be inexact or imprecise.  For instance, a corrected
    version of the Koopman et al. (2014) decomposition of aggregate exports can be
    computed as:  icio, exporter(country_code) perspective(world) approach(sink).

    For export flows at different disaggregation level it is also possible to compute the
    value of trade that is related to GVCs, i.e. that crosses more than one border.  The
    backward and forward GVC participation measures are based on Borin and Mancini (2015,
    2019) which consistently refine the vertical specialization index proposed by Hummels
    et al.(2001).

    When neither exporter() nor importer() options are specified, the icio command can be
    used to compute the GDP (i.e. value-added) produced by a given country or industry
    (origin()), to measure final demand in different countries and sectors
    (destination()), or a combination of the two (when both origin and destination are
    specified).


Options
    Load an ICIO table (required to run icio):
  -----------------------------------------------------------------------------------------

     icio_load options                            Description
    -------------------------------------------------------------------------------------
      iciotable(table_name [, usertable_options]) specify the icio table to be used for
                                                    the analysis; default is wiodn
      year(#)                                     set the year to be used for the
                                                    analysis; default is the last
                                                    available year: year(2014) for wiodn,
                                                    year(2015) for tivan, year(2015) for
                                                    eora. Not needed for user-provided
                                                    tables
      info                                        describe the source and the version of
                                                    the Input Output databases available
                                                    in icio
    -------------------------------------------------------------------------------------

     table_name                              Description
    -------------------------------------------------------------------------------------
      wiodn                                  World Input-Output Database, last version.
                                               See Timmer et al. (2015) and WIOD website
      tivan                                  OECD Trade in value-added tables, last
                                               version. See OECD (2018) and the dedicated
                                               OECD website
      eora                                   Eora Global MRIO tables. See Lenzen et al.
                                               (2013) and http://worldmrio.com/
      wiodo                                  World Input-Output Database, previous
                                               version
      tivao                                  OECD Trade in value-added tables, previous
                                               version
      user                                   User-created tables. This option allows icio
                                               to work with tables that have been
                                               pre-downloaded and formatted by the user.
                                               See usertable_options. Details on the
                                               required format are specified in the
                                               Remarks section below.
    -------------------------------------------------------------------------------------

    usertable_options                        Description
    -------------------------------------------------------------------------------------
      Only when user is selected in table_name
      userpath(string)                       specifies the full path to a folder
                                               containing two user-defined files: the
                                               user-defined table and country-list files
      tablename(string)                      specifies the name of the user-created table
      countrylistname(string)                specifies the name of the user-created
                                               country-list
    -------------------------------------------------------------------------------------

    Remarks on user provided tables
    -------------------------------------------------------------------------------------

    icio user-created tables and related country lists must be provided in csv format.
    The table's csv file must contain only one matrix of dimension (GxN)x(GxN+GxU), where
    G is the number of countries, N the number of sectors and U the number of uses (i.e.,
    consumption, investment, etc.). As a purely illustrative example, consider the case
    of importing a IO table from WIOD 2016 release (indeed, the user does not need to
    manually import WIOD or TiVA tables, they are already included in the icio package
    and can be loaded using the icio_load command with the appropriate options, see
    icio_load_options).  In this case, the matrix dimension in the user-provided csv file
    should be (44x56)x(44x56+44X5), that is 2464x2684, since G=44, N=56, U=5. Thus
    considering a standard excel file of a WIOD table (release 2016) downloaded from the
    official website, the user provided csv should include only data in the cell range E7
    to CYJ2470. More in general, country and sector labels, total output, total
    consumption and total value-added must not be included in the csv.  Country list's
    csv file must only contain a vector (Gx1) of country names, reflecting the same order
    adopted in the provided table's csv file.
    -------------------------------------------------------------------------------------

    Supply, final demand and supply-final demand linkages:
    -------------------------------------------------------------------------------------

    Through basic Input Output accounting, icio can display the GDP (i.e. value-added)
    produced by a given country/industry (origin of the value-added), the final demand in
    different countries and sectors (destination of the value-added), or a combination of
    the two.  With the options origin(country_code[, sector_code]) and
    destination(country_code[, sector_code]) the desired measure is selected.  Results
    for all countries or all sectors can be computed and displayed simultaneously, using
    the option all for country_code or sector_name.  Note that within a specific
    origin/destination option, country_code and sector_name cannot be all at the same
    time.

    1. Gross Domestic Product:
    Display the value-added produced in a selected country/sector. All countries or all
    sectors can be selected at once with the option all. Examples are:
        icio, origin(usa)
        icio, origin(deu,18)
        icio, origin(all,18)
        icio, origin(deu,all)

    2. Final demand:
    Display the final demand absorbed in a selected country/sector.  All countries or all
    sectors can be selected at once with the option all.  Examples are:
        icio, destination(usa)
        icio, destination(deu,18)
        icio, destination(all,18)
        icio, destination(deu,all)

    3. Value-added by origin and final destination:
    Display the value-added originated in a a selected country/sector and absorbed by the
    final demand of a selected country/sector. All countries or all sectors of origin as
    well as all countries or all sectors of final demand can be selected at once with the
    option all. Examples are:
        icio, origin(deu) destination(chn)
        icio, origin(all) destination(chn)
        icio, origin(deu,8) destination(chn,9)
        icio, origin(deu,all) destination(chn,all)

    Value-added decomposition of trade flows and GVC participation in exports:
    -------------------------------------------------------------------------------------

    Depending on the specific empirical application, the user can choose the appropriate
    options in order to select: i) the desired trade flow; ii) the best suited accounting
    methodology to single out 'double counted' components, i.e. items that are recorded
    several times in gross trade; iii) the appropriate output measures.

    i) Selection of trade flow:
    -------------------------------------------------------------------------------------

    Through the options exporter(country_code[,sector_code]) and/or
    importer(country_code[,sector_code]) the user chooses to retrieve information on:

        1.a - the total aggregate exports of a country
            Example: icio, exporter(usa)
        1.b - the total sectoral exports of a country
            Example: icio, exporter(deu,20)
        2.a - the bilateral aggregate exports of a country toward an importing partner
            Example: icio, exporter(chn) importer(usa)
        2.b - the bilateral sectoral exports of a country toward an importing partner
            Example: icio, exporter(deu,20) importer(usa)
        3.a - the total aggregate imports of a country
            Example: icio, importer(usa)
        3.b - the total sectoral imports of a country
            Example: icio, importer(usa,20)
 
    ii) Accounting methodology:
    -------------------------------------------------------------------------------------
        
    The options perspective() and approach() can be used to select the accounting
    methodology best suited to the specific phenomenon under investigation. In particular
    the option perspective() defines the 'perimeter' according to which something is
    classified as 'value-added' or 'double counted', the latter being the items that
    cross this perimeter more than once.  For instance, the boundaries may be defined at
    the level of the exporting country (or the importing one), or of a specific bilateral
    relation, or of a single exporting sector within a bilateral flow.  Note that the
    perspective may differ from the level of disaggregation of trade flow that is
    considered (i.e. the perimeter that identifies the perspective can be set at a more
    aggregate level as compared to the selected trade flow).  For instance, if the
    question is: what part of a country's GDP is exported? It will be necessary to select
    exporter(country_code) and perspective(exporter) as options, such that the exporting
    country's frontiers as a whole constitute the perimeter that matters in deciding
    whether or not a certain item has to be classified as domestic value-added (GDP) or
    double-counted. The perspective(exporter) has to be used also when one seeks a
    measure of value-added in sectoral and/or bilateral exports that can be added up to
    the exporter's GDP in its total exports.

    Alternative perspectives are better suited to address other issues. For instance, if
    we are interested in measuring the exporter's value-added that is exposed to a tariff
    imposed on a given sector from a certain partner, we want to consider as
    'value-added' the entire GDP that is involved in this sectoral-bilateral
    relationship, even if part of that was previously exported to other countries/sectors
    (i.e. classified as 'domestic double counting' when perspective(exporter) is
    selected). In this case the option perspective(sectbil) has to be chosen so that the
    specific sectoral-bilateral relationship become the new relevant perimeter, and only
    the items that enter multiple times in this trade flow are considered as 'double
    counting'. Whenever an exporting country is specified, the command always allows to
    select the perspective(exporter) as an option, while perspective(sectexp),
    perspective(bilateral) and perspective(sectbil) are available only for sectoral,
    bilateral and sectoral-bilateral flows respectively.

    For the aggregate exports of a country, it is possible to choose perspective(world)
    as an option which is applied to the accounting of foreign value added (FVA), as in
    Koopman et al. (2014) and Miroudot and Ye (2018).  According to this perspective a
    certain item is considered as FVA only the first (or the last) time it crosses a
    foreign border, whereas all the other times it crosses any foreign border it is
    classified as double counted.  Then by using perspective(exporter) a certain item is
    accounted for as FVA only once in the total exports of a country, whereas
    perspective(world) requires it to be accounted for as FVA only once in total world
    exports.

    When the exporter() is not specified, icio allows only perspective(importer) for
    aggregate imports and perspective(sectimp) for sectoral imports. The former should be
    adopted to compute the value-added of a given country that enters, directly or
    indirectly, in the total imports of a given country; the latter to compute the
    value-added that enters in a specific sector of import.

    Whenever the perspective is set at a more aggregate level as compared to the
    considered trade flow, also the option approach() can be defined to choose in which
    disaggregated flow a certain item should be accounted for as 'value-added' or
    'double-counted'. Suppose, for instance, that along the production process a certain
    item is exported by country A first to country B and than to country C.  By choosing
    approach(source) the item is classified as 'value-added' the first time it leaves the
    national border (i.e. in the exports toward B), whereas the sink-based approach
    considers it as 'value-added' the last time it crosses the border (i.e. in the
    exports toward C). The choice between the two approaches depends on the particular
    empirical issue we want to address. The source approach is designed to examine the
    production linkages and the country/sector participation to different types of
    production processes and to study the features of the production processes in which
    export flows are involved. Conversely, the value-added in the sink-based approach is
    recorded as closely as possible to the moment when it is ultimately absorbed.  This
    makes it more suited to studying the relationship between value-added in exports and
    final demand.

    All the perspective() and approach() options available for the different trade flows
    are reported here below.

        1. Value-added and GVC participation in total exports of a country

     a) Value-added and GVC participation in total aggregate exports: Description
    -------------------------------------------------------------------------------------
      perspective(exporter)                             the default
      perspective(world)                                world perspective for foreign
                                                          value-added accounting. This
                                                          perspective entails the
                                                          selection of approach(source)
                                                          (the default) or approach(sink)
    -------------------------------------------------------------------------------------

     b) Value-added and GVC participation in total sectoral exports: Description
    -------------------------------------------------------------------------------------
      perspective(exporter)                             the default. This allows to
                                                          display output for each
                                                          exporting sector at once by
                                                          setting sector_code as all.
                                                          This perspective entails the
                                                          selection of approach(source)
                                                          (the default) or approach(sink)
      perspective(sectexp)                              
    -------------------------------------------------------------------------------------

        2. Value-added and GVC participation in bilateral exports:

     a) Value-added and GVC participation in bilateral aggregate exports: Description
    -------------------------------------------------------------------------------------
      perspective(exporter)                             the default. This perspective
                                                          entails the selection of
                                                          approach(source) (the default)
                                                          or approach(sink)
 
      perspective(bilateral)                            
    -------------------------------------------------------------------------------------

     b) Value-added and GVC participation in bilateral sectoral exports: Description
    -------------------------------------------------------------------------------------
      perspective(exporter)                             the default. This allows to
                                                          display output for each
                                                          exporting sector at once by
                                                          setting sector_code as all.
                                                          This perspective entails the
                                                          selection of approach(source)
                                                          (the default) or approach(sink)
      perspective(sectbil)                              
    -------------------------------------------------------------------------------------

        3. Value-added in total imports of a country:

     a) Value-added in total aggregate imports:         Description
    -------------------------------------------------------------------------------------
      perspective(importer)                             the default
    -------------------------------------------------------------------------------------

     b) Value-added and GVC participation in bilateral sectoral exports: Description
    -------------------------------------------------------------------------------------
      perspective(sectimp)                              the default
    -------------------------------------------------------------------------------------

    iii) Output and other options:
    -------------------------------------------------------------------------------------

    For the selected trade flow, icio allows to compute the main indicators of gross
    trade and value-added by specifying the output() option. For export flows the default
    output option - output(detailed) - shows a complete value-added decomposition of the
    trade flows according to the conceptual scheme proposed by Koopman et al. (2014) and
    refined by Borin and Mancini (2019).  Gross trade - gtrade - is first split in the
    part that is originally produced by the exporting country (domestic content - dc) and
    the part that is produced abroad (foreign content - fc); in turn, each of these
    components is broken down in a part of value-added item (domestic value-added - dva -
    and foreign value-added - fva) and in a part of double counting.  The methodology
    used to single out the value-added and double-counted components changes according to
    the selected perspective/approach options (while gtrade, dc, fc measures have to be
    the same for all the accounting methodologies by construction).  The detailed output
    include also additional indicators of trade in value-added that have been singled out
    in the literature (es. VAX by Johnson and Noguera, 2012; Reflection by Koopman et al.
    2014; DAVAX and VAXIM by Borin and Mancini, 2015 and 2019).  The additional
    indicators that are included in the detailed output vary consistently with the
    selected perspective/approach.

    Instead of the whole detailed output the user can compute only one of the main trade
    indicators choosing one of the following output() options: gtrade, dc, dva, fc and
    fva.
        
    In addition to value-added and gross trade measures, for any export flow it is also
    possible to compute the value of trade that is related to GVCs, as developed in Borin
    and Mancini (2015).  The 'GVC-related trade' includes all the traded items that cross
    at least two international borders, i.e. that are re-exported at least once.  The
    backward and forward GVC participation measures are based on Borin and Mancini (2019)
    which consistently refine the vertical specialization index proposed by Hummels et
    al.(2001).  GVC-related indicators, that are sub-components of the selected export
    flow, are shown in the detailed output by default (or when perspective(exporter) and
    approach(source) are specified).  Alternatively it is possible to obtain a single
    measure of GVC trade by specifying gvc, gvcb and gvcf as arguments of the output()
    option for total, backward and forward GVC indicators respectively.

    For value-added and GVC indicators of the selected trade flow it is also possible to
    single out the country/sector where the goods/services where originally produced by
    specifying the origin(country_code[,sector_code]) option, as well as the
    market/sector where it is absorbed in final demand by specifying the
    destination(country_code[,sector_code]) option.  When one seeks a measure of
    value-added produced by a specific country/sector the option output(va) should be
    specified. Note that, when the country in origin() correspond to that specified in
    exporter(), icio provides the same results when selecting output(dva) or output(va).

    output() options and the other options available for export and import trade flows
    are reported here below.


     Output options for decomposition of exports:         Description
    -------------------------------------------------------------------------------------
      detailed                                            ask for the detailed
                                                            decomposition. This is the
                                                            default if origin/destination
                                                            are not specified.
      gtrade                                              ask for gross trade. This is
                                                            the default if
                                                            origin/destination are
                                                            specified.
      va                                                  ask for value-added
      dc                                                  ask for domestic content
                                                            (dva+domestic double
                                                            counting)
      dva                                                 ask for domestic value-added
      fc                                                  ask for foreign content
                                                            (fva+foreign double counting)
      fva                                                 ask for foreign value-added
      gvc                                                 ask for global value chain
                                                            related trade (gvcb+gvcf). It
                                                            can be computed only if
                                                            perspective(exporter) and
                                                            approach(source) are
                                                            selected, which are also the
                                                            default options for any type
                                                            of exports
      gvcb                                                ask for backward global value
                                                            chain related trade. It can
                                                            be computed only if
                                                            perspective(exporter) and
                                                            approach(source) are
                                                            selected, which are also the
                                                            default options for any type
                                                            of exports
      gvcf                                                ask for forward global value
                                                            chain related trade. It can
                                                            be computed only if
                                                            perspective(exporter) and
                                                            approach(source) are
                                                            selected, which are also the
                                                            default options for any type
                                                            of exports
    -------------------------------------------------------------------------------------

     Output options for decomposition of imports:         Description
    -------------------------------------------------------------------------------------
      gtrade                                              ask for gross trade. This is
                                                            the default
      va                                                  ask for value-added
    -------------------------------------------------------------------------------------

     Origin and destination of the decomposed trade flow: Description
    -------------------------------------------------------------------------------------
      origin(country_code [, sector_code])                 ask for the country/sector
                                                            where the trade value is
                                                            produced. Results for all
                                                            countries or all sectors can
                                                            be computed and displayed
                                                            simultaneously, using the
                                                            option all for country_code
                                                            or sector_code.
      destination(country_code [, sector_code])            ask for the country/sector
                                                            where the trade value is
                                                            absorbed by final demand.
                                                            Results for all countries or
                                                            all sectors can be computed
                                                            and displayed simultaneously,
                                                            using the option all for
                                                            country_code or sector_code.
    -------------------------------------------------------------------------------------

     General options:                                     Description
    -------------------------------------------------------------------------------------
      save(filename [, replace])                          save the icio output (scalar,
                                                            vector or matrix) in memory
                                                            to an excel file. replace
                                                            specifies that it is okay to
                                                            replace filename.xls if it
                                                            already exists
      groups(grouping_rule "user_defined_group" [...])    specifies a user-defined
                                                            grouping of countries. For
                                                            example, if
                                                            groups(prt,esp,ita,cyp,grc,ml
                                                            > t,tur "south_europe") is
                                                            specified, the group
                                                            "south_europe" will be
                                                            created including Portugal,
                                                            Spain, Italy, Cyprus, Greece,
                                                            Malta and Turkey. The
                                                            comma-separated list of
                                                            country codes
                                                            prt,esp,ita,cyp,grc,mlt,tur
                                                            is in this case the
                                                            grouping_rule while
                                                            "south_europe" is the
                                                            user_defined_group name. Run
                                                            icio, info for the list of
                                                            available country codes for
                                                            the currently loaded IO table
    -------------------------------------------------------------------------------------


Examples

    Set-up:
    -------------------------------------------------------------------------------------

    Load a specific year of the WIOD (last version) table
        icio_load, iciot(wiodn) year(2014)

    Display available country and sector codes for the loaded table
        icio, info

    Supply-final demand linkages:
    -------------------------------------------------------------------------------------

    What is the GDP (value-added) produced by each country?
        icio, origin(all)

    How much value-added does each country produces in a given sector?
        icio, origin(all,19)

    What is the aggregate final demand of each country?
        icio, destination(all)

    What is the value-added originated in Germany and absorbed in China?
        icio, origin(deu) destination(chn)

    Where the value-added produced in the Italian sector 19 is absorbed?
        icio, origin(ita,19) destination(all)

    Which final demand sectors in China are the most important for the absorption of
    US-made value-added?
        icio, origin(usa) destination(chn,all)

    Where the GDP produced in each country is absorbed (and save the output as
    "supply_demand.xls" in the current working directory)?
        icio, origin(all) destination(all) save("supply_demand.xls")

    How much USMCA (former NAFTA) countries' final demand in sector 20 is satisfied by
    Chinese productions?
        icio, origin(chn) destination(usmca,20) groups(usa, mex, can, "usmca")

    Value-added trade and GVC participation:
    -------------------------------------------------------------------------------------

    Which part of a country’s total exports is home produced, i.e. is domestic GDP?
        icio, exporter(deu) output(dva)

    Which part of a country’s total exports can be traced back to other countries GDP?
        icio, exporter(deu) output(fva)

    Where the foreign value-added in German exports is produced?
        icio, origin(all) exporter(deu) output(fva)

    Considering the bilateral exports from Italy to Germany, where the Italian GDP
    (domestic VA) re-exported by Germany is absorbed?
        icio, exporter(ita) importer(deu) destination(all) output(dva)

    How can be obtained the complete breakdown by origin and destination of the
    value-added (both domestic and foreign) for Chinese exports to the US?
        icio, origin(all) exporter(chn) importer(usa) destination(all) output(va)
            save("CHN_to_USA.xls")

    Which share of the German exports is related to GVC, i.e. cross more than one border?
        icio, exporter(deu) output(gvc)

    Which share of the German exports is related to backward and forward GVC?
        icio, exporter(deu) output(gvcb)
        icio, exporter(deu) output(gvcf)

    Note that it is possible to get a detailed assessment of trade in value-added and GVC
    participation regarding a certain trade flow running:
        icio, exporter(deu)
        icio, exporter(usa) importer(chn)
        icio, exporter(deu,19) importer(chn)

    How can the (corrected) Koopman et al. (2014) decomposition be retrieved using icio?
        icio, exporter(deu) perspective(world) approach(sink)

    Trade policy analysis:
    -------------------------------------------------------------------------------------

    Which is the Chinese GDP that at any point in time, passes through a certain
    bilateral trade flow, say Chinese exports to the US? In other terms, what is the
    Chinese GDP potentially exposed to US tariffs on imports from China?
        icio, exp(chn) imp(usa) persp(bilat) output(dva)

    Which is the German GDP potentially exposed to US tariffs on all imports?
        icio, origin(deu) imp(usa) persp(importer) output(va)

    Which is the German GDP that could be affected by US tariffs on imports in sector 20?
        icio, origin(deu) imp(usa,20) persp(sectimp) output(va)

    Which is the exposure of US GDP to a Chinese tariff on US imports in sector 17?
        icio, exp(usa,17) imp(chn) persp(sectbil) output(dva)

    To what extent are Italian sectors exposed to a shock on German's exports in sector
    20?
        icio, origin(ita,all) exp(deu,20) persp(sectexp) output(va)

    Miscellaneous:
    -------------------------------------------------------------------------------------

    Store results in an excel file
        icio, exporter(usa,all) save("USA_exports_decomp.xls")

    Display (and save) large dimension results
        icio, exporter(usa,all) save("USA_exports_decomp.xls")
        matlist r(detailed)

        icio, origin(all) destination(all) save("supply_demand.xls")
        matlist r(vby)

    Load a user-created table
        icio_load, iciot(user, userp("path_to_the_table_folder") tablen(ADB_2011.csv)
            countrylist(adb_countrylist.csv))

    Computes the detailed decomposition for a list of countries and stores the results in
    two matrices (dollar values and shares).
        loc countries "ita deu fra esp"
        foreach c of local countries {
             qui icio, exp(`c')
             m st_matrix("total_exports", st_matrix("r(detailed)")[.,1])
             mat results_dollars = nullmat(results_dollars), total_exports
             m st_matrix("total_exports_shares", st_matrix("r(detailed)")[.,2])
             mat results_shares = nullmat(results_shares), total_exports_shares
        }
        matlist results_dollars
        matlist results_shares


Citations

    icio is not an official Stata command.  It is a free contribution to the research
    community.  Please cite it as such:

    Belotti, F., Borin, A., and Mancini, M. 2019. icio: Economic Analysis with
        Inter-Country Input-Output tables in Stata, CEIS Research Papers (forthcoming).

    When measures of value-added in trade and GVC participation are used, please also
    cite:

    Borin, A., and Mancini, M. (2019). Measuring What Matters in Global Value Chains and
        Value-Added Trade. Policy Research Working Paper; No. 8804. World Bank.

    Further, you can cite the other works that have contributed to the development of
    each specific measure (see Borin and Mancini, 2019, for a critical discussion of the
    different accounting methodologies proposed in the literature).


References

    Borin, A., and Mancini, M. (2015). Follow the value added: bilateral gross export
    accounting. Economic Working Papers; No. 1026. Bank of Italy.

    Borin, A., and Mancini, M. (2019). Measuring What Matters in Global Value Chains and
    Value-Added Trade. Policy Research Working Paper; No. 8804. World Bank.

    Hummels, D., Ishii, J. and Yi, K. M. (2001). The Nature and Growth of Vertical
    Specialization in World Trade. Journal of International Economics, Vol. 54, pp.
    75-96.

    Koopman, R., Wang, Z., and Wei, S. (2014). Tracing Value-Added and Double Counting in
    Gross Exports.  American Economic Review, 104(2), 459-94.

    Johnson, R. C., (2018). Measuring Global Value Chains. Annual Review of Economics;
    Vol. 10:207-236.

    Johnson, R. C., and Noguera, G. (2012). Accounting for Intermediates: Production
    Sharing and Trade in Value Added. Journal of International Economics; Vol. 86, Iss.
    2, pp. 224-236.

    Lenzen, M., Moran, D., Kanemoto, K., and Geschke, A. (2013). Building Eora: A Global
    Multi-regional Input-Output Database at High Country and Sector Resolution. Economic
    Systems Research; Vol. 25:1, pp.20-49.

    Los, B., and Timmer, M. P. (2018). Measuring Bilateral Exports of Value Added: A
    Unified Framework. NBER Working Paper; No. 24896.

    Los, B., Timmer, M. P., and de Vries, G. J. (2016). Tracing Value-Added and Double
    Counting in Gross Exports: Comment. American Economic Review; Vol. 106 (7), pp.
    1958-66.

    Miroudot, S., and Ye, M. (2018). Tracing value-added and double counting in sales of
    foreign affiliates and domestic-owned companies. MPRA Paper; No. 85723. University
    Library of Munich.

    Nagengast, A.J., and Stehrer, R. (2016). Collateral imbalances in intra-European
    trade? Accounting for the differences between gross and value-added trade balances.
    The World Economy; Vol. 39, No. 9, 2016, pp. 1276–1306.

    OECD, Trade in Value Added database,
    2018, oe.cd/tiva and http://www.oecd.org/sti/ind/inter-country-input-output-tables.ht
    > m.

    Timmer, M. P., Dietzenbacher, E., Los, B., Stehrer, R. and de Vries, G. J. (2015).
    An Illustrated User Guide to the World Input-Output Database: the Case of Global
    Automotive Production.  Review of International Economics; Vol. 23, pp. 575–605.

    Wang, Z., Wei, S., and Zhu, K. (2013). Quantifying International Production Sharing
    at the Bilateral and Sector Levels. NBER Working Paper; No. 19677.


Saved results

    icio saves the following in r():

    Macros         
      r(cmd)              icio
      r(table)            the name of the used ICIO table
      r(table_year)       the year of the used ICIO table
      r(wiod_release)     the vintage of loaded wiod table
      r(tiva_release)     the vintage of loaded tiva table
      r(eora_release)     the vintage of loaded eora table

      r(exporter)         the exporter country
      r(importer)         the importer country
      r(perspective)      the perspective
      r(approach)         the approach
      r(origin)           the origin country
      r(destination)      the destination country
      r(out_detail)       output detail

    Matrices       
      r(vby)                   matrix containing the results of the supply-final demand
                                 analysis
      r(detailed)              matrix containing the detailed results of the value-added
                                 decomposition of trade
      r(gtrade)                matrix containing the gross trade
      r(va)                    matrix containing the value-added
      r(dc)                    matrix containing the domestic content
      r(dva)                   matrix containing the domestic value-added
      r(fc)                    matrix containing the foreign content
      r(fva)                   matrix containing the foreign value-added
      r(gvc)                   matrix containing the GVC related exports
      r(gvcb)                  matrix containing the GVC related exports, backward
      r(gvcf)                  matrix containing the GVC related exports, forward


Authors

    Federico Belotti
    Department of Economics and Finance
    University of Rome Tor Vergata
    Rome, Italy
    federico.belotti@uniroma2.it

    Alessandro Borin
    Bank of Italy
    Rome, Italy
    alessandro.borin@bancaditalia.it

    Michele Mancini
    Bank of Italy
    Rome, Italy
    michele.mancini@bancaditalia.it