Title: One Sector Armington-CES Gravity Model with General Equilibrium
Type: Package
Version: 1.0.0
Description: Implements a one-sector Armington-CES gravity model with general equilibrium (GE) effects. This model is designed to analyze international and domestic trade by capturing the impacts of trade costs and policy changes within a general equilibrium framework. Additionally, it includes a local parameter to run simulations on productivity. The package provides functions for calibration, simulation, and analysis of the model.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
Imports: stats
NeedsCompilation: no
Packaged: 2025-04-21 18:26:20 UTC; Noe.Nava
Author: Noé J Nava [aut, cre], Maros Ivanic [aut]
Maintainer: Noé J Nava <noejnava2@gmail.com>
Repository: CRAN
Date/Publication: 2025-04-24 07:50:02 UTC

Solves one sector Armington-CES gravity model with general equilibrium

Description

Solves one sector Armington-CES gravity model with general equilibrium

Usage

gravityGE(
  trade_data,
  theta = 4,
  beta_hat_name = NULL,
  a_hat_name = NULL,
  multiplicative = FALSE
)

Arguments

trade_data

A data frame that contains 'orig', 'dest', and 'flow' named columns, with additional variables as described below.

theta

Trade elasticity parameter (default = 4).

beta_hat_name

A character name in trade_data for the beta_hat variable. If NULL, a matrix of ones is used. Domestic trade ('orig' == 'dest') must have a value of 0.

a_hat_name

A character name in trade_data for the a_hat variable. If NULL, a matrix of ones is used. All values across 'orig' in a_hat must be the same.

multiplicative

Logical. If TRUE, the model is multiplicative. If FALSE, the model is additive. Default = FALSE. Additive is recommended when trade data is unbalanced.

Value

A list containing two data frames. A dyadic ('orig' and 'dest') data frame with the new trade flows, and a unidirectional ('orig') data frame with the welfare effects.

Examples


flows <- expand.grid(LETTERS, LETTERS)
flows$flow <- 1
names(flows)[1:2] <- c("orig", "dest")

# There should be no change in welfare (all ones)
out <- gravityGE::gravityGE(
  trade_data = flows,
  theta = 4,
  beta_hat_name = NULL,
  a_hat_name = NULL,
  multiplicative = FALSE
)