Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ To use the toolbox, the users need **MATLAB**, the **MATLAB Optimization Toolbox

These examples provide step-by-step instructions to help users effectively navigate and utilize the toolbox.

## Data Sources

This repository uses data from the following sources:
1. OECD Inter-Country Input-Output Tables: 2023 release (accessed on 20.11.2023), 2025 edition (accessed on 12.01.2026), [url](https://www.oecd.org/en/data/datasets/inter-country-input-output-tables.html)

2. ADB Multiregional Input-Output Tables (accessed on 03.07.2024), [url](https://kidb.adb.org/globalization/current)

3. U.S. Bureau of Economic Analysis, "The Use of Commodities by Industries" (accessed on 27.09.2023), [url](https://apps.bea.gov/iTable/?reqid=1602&step=6&Categories=IoUnderlying&isURI=1&_gl=1*1e6wj32*_ga*MTExMDM0NjIwMi4xNzQ1OTMyNTYz*_ga_J4698JNNFT*czE3NzQzNDEwMzAkbzQkZzEkdDE3NzQzNDE4ODQkajE1JGwwJGgw#eyJhcHBpZCI6MTYwMiwic3RlcHMiOlsxLDIsMyw0LDRdLCJkYXRhIjpbWyJjYXRlZ29yaWVzIiwiQVIiXSxbIlRhYmxlX0xpc3QiLCJVc2VBUlBybyJdLFsiUmJEZXRhaWxMdmwiLCJTVU0iXSxbIkxhc3RfWWVhciIsIjIwMTkiXSxbIlJvd3MiLFsiQUxMIiwiMTExQ0EiLCIxMTNGRiIsIjIxMSIsIjIxMiIsIjIxMyIsIjIyIiwiMjMiLCIzMjEiLCIzMjciLCIzMzEiLCIzMzIiLCIzMzMiLCIzMzQiLCIzMzUiLCIzMzYxTVYiLCIzMzY0T1QiLCIzMzciLCIzMzkiLCIzMTFGVCIsIjMxM1RUIiwiMzE1QUwiLCIzMjIiLCIzMjMiLCIzMjQiLCIzMjUiLCIzMjYiLCI0MiIsIj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iODEiLCJHRkdEIiwiR0ZHTiIsIkdGRSIsIkdTTEciLCJHU0xFIiwiVE9UIiwiRjAxMCIsIkYwMlMiLCJGMDJFIiwiRjAyTiIsIkYwMlIiLCJGMDMwIiwiRjA0MCIsIkYwNTAiLCJGMDZDIiwiRjA2UyIsIkYwNkUiLCJGMDZOIiwiRjA3QyIsIkYwN1MiLCJGMDdFIiwiRjA3TiIsIkYxMEMiLCJGMTBTIiwiRjEwRSIsIkYxME4iLCJUT1QiLCJUT1QiXV1dfQ==
)

4. U.S. Bureau of Labor Statistics, "Employment and Output by Industry" (accessed on 02.10.2023), [url](https://www.bls.gov/emp/tables/industry-employment-and-output.htm)

Please ensure proper attribution to each source as per their terms of use.

## Licence Note

This repository is released under the Apache License 2.0, as specified in the LICENSE file. However, data from external sources (e.g., OECD, ADB, BEA, and BLS) are subject to their respective terms of use and are not covered by the Apache License 2.0. Users must comply with the licensing and attribution requirements of each data source, as outlined in their terms of use, when using or sharing the data.

## Disclaimer

Expand Down
12 changes: 6 additions & 6 deletions bis_multisector_model.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// @#define nsector = 20
// @#define n_ait_loop = 1

@#include "utility\variables.m"
@#include "utility\variables_exo.m"
@#include "utility/variables.m"
@#include "utility/variables_exo.m"

@#include "utility\parameters.m"
@#include "utility/parameters.m"

verbatim;

Expand Down Expand Up @@ -263,9 +263,9 @@ sig_mm = d_sig_mm;

// ========================================================================

@#include "utility\equations_combined.mod"
@#include "utility/equations_combined.mod"

steady ;
//steady ;

shocks;
var eps_g; stderr 0 ;
Expand All @@ -284,4 +284,4 @@ end ;

write_latex_dynamic_model;

stoch_simul(order=1, irf = 20, nomoments, nofunctions, nocorr, nodecomposition, nograph) ;
stoch_simul(order=1, irf = 0, nomoments, nofunctions, nocorr, nodecomposition, nograph, noprint) ;
4,254 changes: 4,254 additions & 0 deletions input/data/ICIO2025edition_2019.csv

Large diffs are not rendered by default.

Binary file modified input/data/IO_mapping.xlsx
Binary file not shown.
126 changes: 63 additions & 63 deletions input/progs/f_factor_shares.m
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
function t_factors = f_factor_shares(folder_path,mapping_file,source,industry_names,t_io_final)

% -------------------------------------------------------------------------
% This function decomposes total value added (from ADB MRIO and OECD ICIO)
% into labor and capital components using industry-specific ratios from
% the US, based on data from the US BEA IO table.
% -------------------------------------------------------------------------

% 1.1 Load data on factor inputs from the US BEA IO table
filename_us_factors = fullfile(folder_path, 'input', 'data', 'US_Input_Output_Detail_2019.xlsx');
t_us_factors = readtable(filename_us_factors);
factors = {'Compensation of employees','Gross operating surplus'}; % Labour, capital
t_us_factors = t_us_factors(ismember(t_us_factors.Commodities_Industries,factors),:);
t_us_factors = rows2vars(t_us_factors);
t_us_factors.Properties.VariableNames = table2array(t_us_factors(2,:));
t_us_factors.Code = t_us_factors.Commodities_Industries;

% 1.2 Map sectors into broader industries
var_codes_us_factors = readtable(mapping_file, 'Sheet', 'IO_VariableCodes_BEA');
t_us_factors = innerjoin(t_us_factors,var_codes_us_factors,'Keys','Code');

if strcmp(source,'oecd')
t_us_factors.Code_std_20(strcmp(t_us_factors.Code_std_20,'Wholesale')) = {'WholesaleAndRetail'};
t_us_factors.Code_std_20(strcmp(t_us_factors.Code_std_20,'Retail')) = {'WholesaleAndRetail'};
end

t_us_factors = t_us_factors(ismember(t_us_factors.Code_std_20,industry_names),:);

t_us_factors = t_us_factors(:,["Code_std_20","Compensation of employees","Gross operating surplus"]);
t_us_factors.("Compensation of employees") = cell2mat(t_us_factors.("Compensation of employees"));
t_us_factors.("Gross operating surplus") = cell2mat(t_us_factors.("Gross operating surplus"));
t_us_factors = groupsummary(t_us_factors,"Code_std_20","sum");

% 1.3 Sort
[~, order] = ismember(t_us_factors.Code_std_20, industry_names);
[~, sortIdx] = sort(order);
t_us_factors = t_us_factors(sortIdx, :);
t_us_factors.Properties.VariableNames = replace(t_us_factors.Properties.VariableNames,"sum_","");
t_us_factors.Properties.RowNames = t_us_factors.Code_std_20;
t_us_factors(:,{'GroupCount','Code_std_20'}) = [];

% 1.4 Join with value added in the IO table for the selected economy
t_va = rows2vars(t_io_final("ValueAdd",:));
t_va = t_va(ismember(t_va.OriginalVariableNames,industry_names),:);
t_va.Properties.RowNames = t_va.OriginalVariableNames;
t_va.OriginalVariableNames = [];
t_factors = [t_us_factors t_va];

% 1.5 Take the ratio of labour/capital to total value added for the US
% data and multiply these ratios by the value added for the selected economy
t_factors.VA_Labour = t_factors.ValueAdd ...
.* (t_factors.("Compensation of employees") ...
./ (t_factors.("Compensation of employees") + t_factors.("Gross operating surplus")));
t_factors.VA_Capital = t_factors.ValueAdd ...
.* (t_factors.("Gross operating surplus") ...
./ (t_factors.("Compensation of employees") + t_factors.("Gross operating surplus")));

% 1.6 Transpose to get ready to be joined with io_inputs
t_factors = rows2vars(t_factors(:,["VA_Labour","VA_Capital"]));
t_factors.Properties.RowNames = t_factors.OriginalVariableNames;
t_factors.OriginalVariableNames = [];

end
function t_factors = f_factor_shares(folder_path,mapping_file,source,industry_names,t_io_final)
% -------------------------------------------------------------------------
% This function decomposes total value added (from ADB MRIO and OECD ICIO)
% into labor and capital components using industry-specific ratios from
% the US, based on data from the US BEA IO table.
% -------------------------------------------------------------------------
% 1.1 Load data on factor inputs from the US BEA IO table
filename_us_factors = fullfile(folder_path, 'input', 'data', 'US_Input_Output_Detail_2019.xlsx');
t_us_factors = readtable(filename_us_factors);
factors = {'Compensation of employees','Gross operating surplus'}; % Labour, capital
t_us_factors = t_us_factors(ismember(t_us_factors.Commodities_Industries,factors),:);
t_us_factors = rows2vars(t_us_factors);
t_us_factors.Properties.VariableNames = table2array(t_us_factors(2,:));
t_us_factors.Code = t_us_factors.Commodities_Industries;
% 1.2 Map sectors into broader industries
var_codes_us_factors = readtable(mapping_file, 'Sheet', 'IO_VariableCodes_BEA');
t_us_factors = innerjoin(t_us_factors,var_codes_us_factors,'Keys','Code');
if ismember(source,{'oecd','oecd2025e'})
t_us_factors.Code_std_20(strcmp(t_us_factors.Code_std_20,'Wholesale')) = {'WholesaleAndRetail'};
t_us_factors.Code_std_20(strcmp(t_us_factors.Code_std_20,'Retail')) = {'WholesaleAndRetail'};
end
t_us_factors = t_us_factors(ismember(t_us_factors.Code_std_20,industry_names),:);
t_us_factors = t_us_factors(:,["Code_std_20","Compensation of employees","Gross operating surplus"]);
t_us_factors.("Compensation of employees") = cell2mat(t_us_factors.("Compensation of employees"));
t_us_factors.("Gross operating surplus") = cell2mat(t_us_factors.("Gross operating surplus"));
t_us_factors = groupsummary(t_us_factors,"Code_std_20","sum");
% 1.3 Sort
[~, order] = ismember(t_us_factors.Code_std_20, industry_names);
[~, sortIdx] = sort(order);
t_us_factors = t_us_factors(sortIdx, :);
t_us_factors.Properties.VariableNames = replace(t_us_factors.Properties.VariableNames,"sum_","");
t_us_factors.Properties.RowNames = t_us_factors.Code_std_20;
t_us_factors(:,{'GroupCount','Code_std_20'}) = [];
% 1.4 Join with value added in the IO table for the selected economy
t_va = rows2vars(t_io_final("ValueAdd",:));
t_va = t_va(ismember(t_va.OriginalVariableNames,industry_names),:);
t_va.Properties.RowNames = t_va.OriginalVariableNames;
t_va.OriginalVariableNames = [];
t_factors = [t_us_factors t_va];
% 1.5 Take the ratio of labour/capital to total value added for the US
% data and multiply these ratios by the value added for the selected economy
t_factors.VA_Labour = t_factors.ValueAdd ...
.* (t_factors.("Compensation of employees") ...
./ (t_factors.("Compensation of employees") + t_factors.("Gross operating surplus")));
t_factors.VA_Capital = t_factors.ValueAdd ...
.* (t_factors.("Gross operating surplus") ...
./ (t_factors.("Compensation of employees") + t_factors.("Gross operating surplus")));
% 1.6 Transpose to get ready to be joined with io_inputs
t_factors = rows2vars(t_factors(:,["VA_Labour","VA_Capital"]));
t_factors.Properties.RowNames = t_factors.OriginalVariableNames;
t_factors.OriginalVariableNames = [];
end
41 changes: 21 additions & 20 deletions input/progs/f_iso2_to_oecdicio.m
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
function oecdcode = f_iso2_to_oecdicio(iso2)
% This function converts standard ISO-2 country codes to ISO-3 codes used in OECD ICIO

iso2cell = {'AR','AU','AT','BE','BD','BG','BY','BR','BN','CA','CH','CL','CN',...
'CI','CM','CO','CR','CY','CZ','DE','DK','EG','ES','EE','FI','FR','GB','GR',...
'HK','HR','HU','ID','IN','IE','IS','IL','IT','JO','JP','KZ','KH','KR','LA',...
'LT','LU','LV','MA','MX','MT','MM','MY','NG','NL','NO','NZ','PK','PE',...
'PH','PL','PT','RO','RU','SA','SN','SG','SK','SI','SE','TH','TN','TR',...
'TW','UA','US','VN','ZA'};

oecdcell = {'ARG','AUS','AUT','BEL','BGD','BGR','BLR','BRA','BRN','CAN','CHE','CHL','CHN',...
'CIV','CMR','COL','CRI','CYP','CZE','DEU','DNK','EGY','ESP','EST','FIN','FRA','GBR','GRC',...
'HKG','HRV','HUN','IDN','IND','IRL','ISL','ISR','ITA','JOR','JPN','KAZ','KHM','KOR','LAO',...
'LTU','LUX','LVA','MAR','MEX','MLT','MMR','MYS','NGA','NLD','NOR','NZL','PAK','PER',...
'PHL','POL','PRT','ROU','RUS','SAU','SEN','SGP','SVK','SVN','SWE','THA','TUN','TUR',...
'TWN','UKR','USA','VNM','ZAF'};

oecdcode = oecdcell(strcmp(iso2,iso2cell));

end
function oecdcode = f_iso2_to_oecdicio(iso2)
% This function converts standard ISO-2 country codes to ISO-3 codes used
% in OECD ICIO (both 2023 and 2025 editions)

iso2cell = {'AE','AO','AR','AT','AU','BE','BD','BG','BY','BR','BN','CA',...
'CD','CH','CL','CN','CI','CM','CO','CR','CY','CZ','DE','DK','EG','ES',...
'EE','FI','FR','GB','GR','HK','HR','HU','ID','IN','IE','IS','IL','IT',...
'JO','JP','KZ','KH','KR','LA','LT','LU','LV','MA','MX','MT','MM','MY',...
'NG','NL','NO','NZ','PK','PE','PH','PL','PT','RO','RU','SA','SN','SG',...
'SK','SI','SE','ST','TH','TN','TR','TW','UA','US','VN','ZA'};

oecdcell = {'ARE','AGO','ARG','AUT','AUS','BEL','BGD','BGR','BLR','BRA','BRN','CAN',...
'COD','CHE','CHL','CHN','CIV','CMR','COL','CRI','CYP','CZE','DEU','DNK','EGY','ESP',...
'EST','FIN','FRA','GBR','GRC','HKG','HRV','HUN','IDN','IND','IRL','ISL','ISR','ITA',...
'JOR','JPN','KAZ','KHM','KOR','LAO','LTU','LUX','LVA','MAR','MEX','MLT','MMR','MYS',...
'NGA','NLD','NOR','NZL','PAK','PER','PHL','POL','PRT','ROU','RUS','SAU','SEN',...
'SGP','SVK','SVN','SWE','STP','THA','TUN','TUR','TWN','UKR','USA','VNM','ZAF'};

oecdcode = oecdcell(strcmp(iso2,iso2cell));

end
Loading