What counts as a replication
The same matrix, the same closure, the same elasticities, the same shock, set against one published number. The base year has to come back. A deviation is reported with its cause.
Two kinds of paper come first. A paper that ships the matrix, the code and a table. Then a paper that uses a public matrix, when the shock and the elasticities are described well enough to be rebuilt. A licensed database, the GTAP Data Base in particular, is a later queue: the code of the standard GTAP model in GAMS is published, and the database is not. It will not be committed here.
Several regions are a separate extension
One region is enough for a national model. The worked example below is one closed economy, and the next files in the queue are national too. Several regions, as far as the package goes today, are an origin nest: each region produces, buyers pay a national composite of those origins, and the Armington still mixes that composite with foreign imports. Factors do not migrate. A GTAP paper or an interregional model in the tradition of B-MARIA or TERM also wants migration, and GTAP wants its licensed database. A result of that kind will not be claimed from the origin nest alone. The roadmap keeps the rest of the item, and the catalog says so on the row.
Worked example: Hosoe, Gasawa and Hashimoto, chapter 5
The matrix below is the one printed in splcge, the simple CGE in the
GAMS model library.
The citation in that file is Hosoe, Gasawa and Hashimoto, Handbook of Computable General
Equilibrium Modeling, University of Tokyo Press, 2004, chapter 5. The published program
solves the benchmark and no counterfactual, so the check is the benchmark.
Bread and milk, capital and labour, one household. Production is Cobb–Douglas in the two
factors and there are no intermediate inputs, which is sigma_va=1 with an empty
intermediate block. Labour is the numeraire. The published matrix has no government, no
investment and no rest of the world; the package requires those three accounts, so they are
entered empty. Investment of zero is a shut block, not a basket to be split.
import pandas as pd
import cgelab as cge
entries = [
("c_brd", "hh_1", 15.0), ("c_mlk", "hh_1", 35.0),
("f_cap", "a_brd", 5.0), ("f_cap", "a_mlk", 20.0),
("f_lab", "a_brd", 10.0), ("f_lab", "a_mlk", 15.0),
("hh_1", "f_cap", 25.0), ("hh_1", "f_lab", 25.0),
("a_brd", "c_brd", 15.0), ("a_mlk", "c_mlk", 35.0),
("gov", "gov", 0.0), ("s_i", "s_i", 0.0), ("row", "row", 0.0),
]
sam = cge.SAM.from_long(pd.DataFrame(entries, columns=["row", "col", "value"]), name="hosoe")
sam.check_balance(abs_tol=1e-9)
spec = cge.ModelSpec(
activities=["a_brd", "a_mlk"], commodities=["c_brd", "c_mlk"],
households=["hh_1"], factors=("f_lab", "f_cap"),
government="gov", investment="s_i", rest_of_world="row",
sigma_va=1.0, margins=False, numeraire_factor="f_lab")
econ = cge.calibrate(sam, spec)
base = cge.solve_period(econ)
assert base.converged and abs(base.walras) < 1e-9
assert abs(base.X[econ.activity("a_brd")] - 15) < 1e-8
assert abs(base.X[econ.activity("a_mlk")] - 35) < 1e-8
assert abs(base.pq[econ.commodity("c_brd")] - 1) < 1e-8
print(base.X, base.walras)
Solved output is 15 and 35, purchaser prices are 1, imports and saving are 0, and the Walras residual on the numeraire is 0. That is the published benchmark, not a policy table: the GAMS file does not report one.
Worked example: abolishing tariffs in stdcge and lrgcge
Chapters 6 and 10.2 of the same handbook are the GAMS library files
stdcge
and lrgcge.
They have one matrix, with intermediates, an indirect tax on output (IDT), a tariff (TRF),
government, investment and the rest of the world, and one experiment: every tariff set to zero.
lrgcge adds a demand curve for exports and a supply curve for imports, each with
elasticity 2.
cgelab.examples.hosoe holds the matrix, with Hosoe's accounts split into an
activity and a commodity, his functional forms and his closure. Government saves a fixed share
of its income, and foreign saving is fixed in dollars. The tariff sits inside the import price
and the indirect tax inside the gross output price, as in his calibration.
import numpy as np
import cgelab as cge
from cgelab.examples import hosoe
for large in (False, True):
_, econ = hosoe.build(large_country=large)
base = cge.solve_period(econ, hosoe.CLOSURE)
free = cge.solve_period(econ, hosoe.CLOSURE, cge.Scenario(tariff=np.zeros(econ.n_com)))
assert free.converged and abs(free.walras) < 1e-9
print("lrgcge" if large else "stdcge",
np.round(100 * (free.imports / base.imports - 1), 2), # imports, % change
round(100 * (free.exchange_rate - 1), 2)) # exchange rate, % change
The programs compute these changes and print no table, and GAMS is not installed here. The
reference is therefore validation/hosoe.jl, a line-by-line JuMP transcription of
the two .gms files (matrix, calibration and equations), solved with Ipopt. All 49
variables the programs display match, at the base year and after the abolition, to 2.4e-12.
The suite checks the stored result without Julia.
| Percent change (bread / milk) | stdcge | lrgcge |
|---|---|---|
| Imports | −1.08 / +18.85 | −2.78 / +6.76 |
| Exports | +17.93 / +12.46 | +10.55 / +9.42 |
| Household consumption | +1.96 / +2.51 | +0.85 / +1.13 |
| Government consumption | −6.85 / −6.35 | −7.83 / −7.58 |
| Exchange rate | +6.28 | +9.51 |
| World export price | 0 / 0 | −4.89 / −4.40 |
| Equivalent variation, level | 1.145 | 0.508 |
Milk carried the higher tariff, 18% against 8%, and takes the import market: bread
imports fall. Government loses the tariff revenue and cuts its consumption. The currency
depreciates to pay for the extra imports, and exports rise. As a large country,
lrgcge pays for that rise with lower world export prices, so the welfare gain is
less than half.
The queue
Status is what has been run in this package. "Files located" means the matrix or the code was found and has not been solved here yet.
| Model | Data | Regions | Status |
|---|---|---|---|
Hosoe, Gasawa and Hashimoto (2004), ch. 5, GAMS library splcge |
Matrix printed in the library file | One, closed | Benchmark reproduced on this page |
Hosoe, Gasawa and Hashimoto (2004), ch. 6 and 10.2, GAMS library stdcge and lrgcge |
Matrix printed in the library files | One, open | Tariff abolition reproduced on this page, against a transcription of the programs |
| Lofgren, Harris and Robinson (2002), IFPRI standard CGE in GAMS | The manual is open. The sample database was distributed with the book and is not in the PDF now on CGSpace | One country, with trade, margins and home production | Next, once the database file is in hand |
| Mukashov, Senegal, IFPRI-standard GAMS, paper on regional income equity | Matrix, elasticities and scenarios shipped in the repository | One national model in the IFPRI structure. Whether "regional" is a household split or several trading regions is read off the matrix before any number is claimed | Files located, not yet solved |
| van der Mensbrugghe (2018), standard GTAP model in GAMS, version 7 | GAMS code with the article. The GTAP Data Base is licensed | Many | Needs the GTAP structure and a licence. The origin nest is not that model. The database will not be committed |
| Cicowiez and Lofgren (2017), World Bank WPS 8273 | Method and macro matrices for 133 countries, public | One production account per country | Public data, no published shock to match. Second wave |
| IFPRI Nexus social accounting matrices | The matrix, CC-BY, not an experiment | One country | Public data. Second wave: calibrate, and only claim a table when the paper's shock is fully described |