`trade`

is a suite of tools that may be used in assessing the implications of tariffs. The package contains
functions that can calibrate the underlying parameters of a number
of different supply and demand models as well as simulate the effects of
tariffs in different strategic
environments. The output generated by these tools includes interesting
features such as predicted price increases, welfare measures and demand
elasticities.

There are four features of `trade`

that make it particularly useful
for practitioners. First, `trade`

collects a number of useful models
onto a common platform, making it easy for
practitioners to compare and contrast the results from different
models.

Second, `trade`

is open source software that runs on the **R** open source
platform. Practically speaking, this means that practitioners not only
have the flexibility to run this software wherever and whenever they
wish, but they can also modify and extend the software as they see
fit. We hope that having this collection of tools on a common, open
source platform will facilitate discussion and collaboration among practitioners.

Third, `trade`

includes a web interface built using `shiny`

. While this interface does not give users access to the full array of functionality in `trade`

, it is simple to use and may provide first-time users, particularly those who are unfamiliar with **R**, a gentler introduction to `trade`

. The interface may be invoked using the `trade_shiny`

function.

Finally, the functions included in `trade`

typically require relatively little information to generate a prediction.

The limited information needed for the economic models used in `trade`

comes at some
cost. First, the output of these models is sensitive to the
supplied inputs. For instance, when employing the Bertrand model, inaccurate margins, shares and prices can yield
inaccurate estimates of demand and cost parameters which can in turn yield
incorrect predictions of a tariff’s effects. Calibrating model
parameters with an array of plausible inputs will yield a range of
outputs and illustrate the sensitivity of each model to those inputs.
One way to
control for inaccurate inputs is to calibrate model parameters with
different plausible inputs to see how the model output
changes. Users can then report a range of plausible outputs in their analysis.

Moreover, none of the parameters calibrated by `trade`

may be used
in frequentist statistical hypothesis testing. In other words, while the economic
models in `trade`

may be used to generate reliable estimates of the
effects of a new tariff regime, statistical tests cannot be used to
determine the accuracy of these estimates. Accomplishing this requires
additional data and is beyond the current scope of `trade`

.

This document provides an introduction to the economic theory upon
which the `trade`

packages’ functions are built. Please use the
`help`

function for assistance invoking any of the functions, classes, or
methods included in `trade`

. Alternatively please refer to the vignette and manpages of `trade`

’s sister
package `antitrust`

from which much of `trade`

was generated.

Much of `trade`

‘s functionality is built around the Bertrand pricing
game.^{1} This version of the game assumes that firms producing multiple
differentiated products with distinct, constant, marginal costs
simultaneously set their products’ prices to maximize their
profits. In this model, prices are *strategic complements* in the sense that increasing the price of
one product causes some customers to switch to other products, raising
the quantities sold and therefore the profit-maximizing prices of these other
products. Ultimately, it is the magnitude of these lost sales that, at
the margin, dissuades firms from raising their prices further .

Tariffs are modeled by effectively assuming that the marginal costs
of certain products produced by
foreign firms increase by the amount of the tariff. Because all products included in `trade`

models are assumed
to be substitutes, this marginal cost increase
causes foreign firms to raise the price of their products, which in turn causes some customers to
either switch to other products in the market or to forgo purchasing any product in the market entirely.

The Bertrand model predicts that tariffs will harm customers and foreign firms, but benefit
domestic firms and raise government revenues. The **magnitude** of these effects, however, will depend
on demand specification as well as the set of inputs used.^{2}

Currently, this version of the Bertrand model does not allow firms to add or reposition products, or allow firms to engage in some forms of price discrimination.

The primary `trade`

function responsible for modeling tariffs in a Bertrand game is `bertrand_tariff`

.

Suppose that there are \(K\) firms in a
market, and that each of the \(k \in K\) firms produces \(n_k\)
products, some of which may be produced domestically and some of which may be produced abroad .^{3} Further, suppose that the government imposes an *ad valorem* tariff \(t_i\) on a subset of products produced abroad. Note that we assume that the tariff is calculated as a proportion of **consumer** price, so that the price received by the firm is \(1-t_i\) the price faced by consumers.

Let \(n=\sum\limits_{k\in K}n_k\) denote the number of products sold by all \(K\) firms. The Bertrand model assumes that firms simultaneously set their products’ prices in order to maximize their profits. This model also assumes that all firms can perfectly observe each others’ prices, quantities, costs, and product characteristics.

This version of the Bertrand model also assumes that each product is produced using its own distinct constant marginal cost technology \(c_i\), for all \(i \in n\). As we will see, this assumption is necessary when information is limited.

Firm \(k \in K\) chooses the prices \(\{p_i\}_{i=1}^{n_k}\) of its products so as to maximize profits. Mathematically, firm \(k\) solves:

\[\begin{align*} \max_{\{p_i\}_{i=1}^{n_k}} &\sum_{i=1}^{n_k}(1-t_i)(p_i - \frac{c_i}{(1-t_i)})q_i, \end{align*}\]

where \(t_i\) equals 0 if the product is not subject to a tariff . \(q_i\), the quantity sold of product \(i\), is assumed to
be a twice differentiable function of \*all* product prices.

Differentiating profits with respect to each \(p_i\) yields the following first order conditions (FOCs):

\[\begin{align*} \partial p_i&\equiv q_i(1-t_i) +\sum_{j=1}^{n_k}(1-t_j)( p_j - \frac{c_j}{1-t_j})\frac{\partial q_j}{\partial p_i}=0& \mbox{ for all $i\in n_k$} \end{align*}\]

which may be rewritten as

\[\begin{align*} \partial p_i&\equiv r_i(1-t_i) + \sum_{j=1}^{n_k} (1-t_j)r_jm_j\epsilon_{ji}=0& \mbox{ for all $i\in n_k$}, \end{align*}\]

where \(r_i\equiv\frac{p_iq_i}{\sum\limits_{j=1}^np_jq_j}\) is
product \(i\)’s revenue share, \(\hat{c}_i\equiv \frac{c_i}{(1-t_i)}\) is product \(i\)’s *effective* marginal cost, \(m_i\equiv\frac{p_i-\hat{c}_i}{p_i}\) is product
\(i\)’s gross margin, and \(\epsilon_{ij}\equiv\frac{\partial q_i}{\partial p_j}\frac{p_j}{q_i}\) is the elasticity of product \(i\) with
respect to the price of product \(j\).

The FOCs for all products may be stacked and then represented using the following matrix notation: \[\begin{align} \tag{2.1} (r\circ diag(\Omega)) + (E\circ\Omega)'(r \circ m)=0 \end{align}\]

where \(r\) and \(m\) are \(n\)-length vectors of revenue shares and margins, \(E = \left(\begin{smallmatrix} \epsilon_{11}&\ldots&\epsilon_{1n}\\\vdots &\ddots&\vdots\\\epsilon_{n1}&\ldots&\epsilon_{nn} \end{smallmatrix}\right)\) is a \(n \times n\) matrix of own- and cross-price elasticities, and \(\Omega=\left(\begin{smallmatrix} \omega_{11}(1-t_1)&\ldots&\omega_{1n}(1-t_1)\\\vdots &\ddots&\vdots\\\omega_{n1}(1-t_n)&\ldots&\omega_{nn}(1-t_n)\end{smallmatrix}\right)\) is an \(n \times n\) matrix whose \(i,j\)th element equals \(\omega_{ij}\), the share of product \(j\)’s profits owned by the firm setting product \(i\)’s price, multiplied by \(1-t_i\), product \(i\)’s tariff rate. In many cases, product \(i\) and \(j\) are wholly owned by a single firm, in which cases \(\omega_{ij}\) equals 1 if \(i\) and \(j\) are owned by the same firm and 0 otherwise. ‘\(diag\)’ returns the diagonal of a square matrix and ‘\(\circ\)’ is the Hadamard (entry-wise) product operator.

The solution to system (2.1) yields equilibrium prices conditional on the ownership structure \(\Omega\) and tariffs \(t_i,\forall i\in n\). A change in tariff policy is modeled as the solution to system (2.1) where \(\Omega\) and \(\hat{c}_i,\forall i\in n\) are updated to reflect the change in tariffs.

The Bertrand model described above assumes that products are produced
with constant marginal costs and no quotas. Here, we
extend this model to allow for quotas
.^{4}

Firm \(k \in K\) chooses the prices \(\{p_i\}_{i=1}^{n_k}\) of its products so as to maximize profits, subject to quotas \(\{\overline{q}_i\}_{i=1}^{n_k}\). Mathematically, firm \(k\) solves:

\[\begin{align*} \max_{\{p_i\}_{i=1}^{n_k}} &\sum_{i=1}^{n}\omega_{ik}(p_i - c_i)q_i,\\ s.t.\, & q_i \le \overline{q}_i,&i=1\ldots n_k \end{align*}\]

In general, either the capacity constraint for product \(i\) will bind and the firm will be forced to produce less of \(i\) than it would find optimal, or the capacity constraint will not bind, and the firm will produce the optimal amount implied by the FOCs. In the former, it can be shown that \(\partial p_i\le 0\) and \(q_i - \overline{q}_i=0\), while in the latter \(\partial p_i=0\) and \(q_i - \overline{q}_i \le 0\). Mathematically, these cases can be written as

\[\begin{align} \max\{\partial p_i, q_i - \overline{q}_i\}=0,&i=1\ldots n_k \tag{2.2} \end{align}\]

The FOCs for the quota-constrained Bertrand game (equation
) suffer from an additional complication: the
function introduces a kink that can make it difficult for the
non-linear equation solver to find equilibrium
prices. (**???**) suggests replacing equation
(2.2) with
\[\begin{align*}
FOC_i + q_i - t_i + \sqrt{FOC_i^2 + (q_i - t_i)^2}=0,& i=1,\ldots,n
\end{align*}\]

which has the same roots as equation (2.2), but is smoother. The method for all classes based on the capacity-constrained Bertrand Model use this smoothed system to solve for equilibrium prices when the constraint is binding.

For the Logit, CES, and AIDS demand specifications allowed under this implementation of the Bertrand model,
the calibration strategy is the same. First, we
assume that quantities/shares and (with the exception of LA-AIDS) prices are observed for *all* products in the
market, and that margins for *some* products
are observed. Our decision to treat quantities, prices, and
margins as primitives comes directly from equation
(2.1).

In addition to quantities, prices, some margins and capacities, we assume that
users observe diversion ratios. Diversion ratios come in two
forms: *quantity* diversion and *revenue* diversion. The
*quantity* diversion from
product \(i\) to product \(j\) \(d^q_{ij}\) is defined as the percentage of all of \(i\)’s
lost unit sales that switch to \(j\) *due to a price increase in product \(i\)*, while the *revenue* diversion from
product \(i\) to product \(j\) \(d^r_{ij}\) is defined as the percentage of all of \(i\)’s
lost revenue that switches to \(j\) *due to a price increase in product \(i\)*. Mathematically, quantity and revenue diversion may be
represented as

\[\begin{align} \tag{2.3} d^q_{ij}=&-\frac{\frac{\partial q_j}{\partial p_i}}{\frac{\partial \nonumber q_i}{\partial p_i}}\\ =& -\frac{\epsilon_{ji}q_j}{\epsilon_{ii}q_i}\\ \tag{2.4} d^r_{ij}=&-\frac{\frac{\partial p_jq_j}{\partial p_i}}{\frac{\partial \nonumber p_iq_i}{\partial p_i}} \\ =&-\frac{\epsilon_{ji}(\epsilon_{jj}-1)r_j}{\epsilon_{jj}(\epsilon_{ii}-1)r_i} \end{align}\]

Note that \(d^q_{ij},d^r_{ij}\) are restricted to be between -1 and 1,
and are positive if products \(i\) and \(j\) are substitutes and negative if they are complements. Additionally, conditional on customers switching from product \(i\), they must switch to another product (i.e. \(\sum_{j}d_{ij}\le 0\)). For all the models included in `trade`

, we assume that \(i\) and \(j\) are not complements (\(d_{ij}\ge 0\)) and for some demand models (i.e. AIDS) we will assume that \(\sum_{j}d_{ij} = 0\).

Although diversion ratios are not present in equation (2.1), these definitions indicate that diversion ratios may be helpful in recovering the matrix of own- and cross-price elasticities \(E\). Indeed, for a number of the demand systems described below, diversions will be used for just this purpose.

We further assume that all of this information represents the outcome of the unique current equilibrium for firms in the market playing the static Bertrand pricing game described above. We then substitute observed margins, shares and prices into equation (2.1), which is now solely a function of demand parameters, and then solve for the coefficient(s) on prices. Once the price coefficients have been estimated, we use observed prices and the demand equations to estimate the intercepts.

Often, there are more FOCs than unknown price coefficients. For instance, under Logit demand, only the price parameter \(\alpha\) and the share of the outside good \(s_0\) needs to be estimated and up to \(n\) FOCs with which to estimate it. This means that at a minimum, users need only supply enough margin information to complete a single product’s FOC. If that product happens to be owned by a single-product firm, then only one margin is necessary. On the other hand, if the product happens to be owned by a multi-product firm, then at a minimum, all the margins for products owned by that firm must be supplied.

The (Marshallian) demand specifications used in `trade`

can be grouped into two
categories: demand systems that are derived from a
representative consumer’s
expenditure function and demand systems that are derived from a
representative consumer’s indirect utility function. The LA-AIDS demand system
fall into the former
category, while the Logit and CES fall into
the latter category. Below, we briefly
discuss these demand systems as well as the assumptions
and/or data needed to recover estimates of the demand parameters.

We conclude this section with a discussion of how calibrated demand parameters and the FOCs can be used to calibrate product-specific constant marginal costs.

The Bertrand model with the linear approximate Almost Ideal Demand System (LA-AIDS) may be implemented
using the `bertrand_tariff`

function with ‘demand’ equal to “aids”.

The LA-AIDS without income effects assumes that the demand for each product \(i \in n\) in the market is given by

\[\begin{align*} r_i=& \alpha_i + \sum_{j\in n}\beta_{ij} \log(p_j) \mbox{ for all $i\in n$},& \beta_{ii}<0 \end{align*}\] which may be written in matrix notation as \[\begin{align*} r=&\alpha + B\log(p),& \end{align*}\]

where \(r,p\) are vectors of product *revenue* shares and prices, \(\alpha\) is a vector of product-specific demand intercepts and
\(B\) is a matrix of slopes^{7}.

The LA-AIDS model yields the following own- and cross-price elasticities: \[\begin{align*} \epsilon_{ii}=&-1 + \frac{\beta_{ii}}{r_i} + r_i(1+ \epsilon),& \epsilon_{ii}<0 \\ \epsilon_{ij}=&\frac{\beta_{ij}}{r_i} + r_j(1+ \epsilon),& \epsilon_{ij}\ge 0 \end{align*}\]

where \(\epsilon\) is the market elasticity of demand.

The LA-AIDS model assumes that \(B\) is symmetric, satisfies homogeneity of degree zero in prices, and that diversion is
known. The LA-AIDS model, however,
assumes that *revenue* diversion, rather than *quantity*
diversion is observed.^{8} Under these two assumptions, there are \(\frac{n(n+3)}{2}\) unknown
demand parameters (\(\frac{n(n-1)}{2}\) diagonal elements in \(B\), \(n\) diagonal elements,and \(n\) intercepts) and up to \(n(n+1)\) equations (\(n(n-1)\) diversion equations, \(n\) FOCs and \(n\) demand equations),
in which case the system is over-identified.^{9}

Unlike the Logit and CES models described above, none of the LA-AIDS model’s equations are a function of the share of the
outside good. Instead, these equations are a function of the market elasticity of demand \(\epsilon\).
Roughly speaking, \(\epsilon\) controls
the extent to which consumers substitute to products outside
the \(n\) products included in the simulation
given a small change in market-wide product prices. Here, we assume that \(\epsilon\) is a parameter whose value is not a function of product prices.^{10}.

The `calcSlopes`

method, called by the `aids`

function to calibrate the AIDS parameters uses a minimum distance algorithm to find the \(\epsilon\) (if not supplied using the ‘mktElast’ argument) and a single diagonal element of \(B\) that best satisfy i) all the FOCs for which there is sufficient information and ii) the diversion equations \(d_{ij}=-\frac{\beta_{ji}}{\beta_{ii}}\), and iii) the market elasticity (if supplied using the ‘mktElast’ argument). The \(\beta_{ii}\)s are recovered from the fact that \(\sum_{j}d_{ij}=0\); customers must switch to a product included in the model.

Another distinguishing feature of the LA-AIDS model is that it does not require any information on product
prices in order to simulate tariff price effects. The LA-AIDS accomplishes this by
using the supplied margin and revenue information to estimate \(B\), but not \(\alpha\). There are
however, a few drawbacks to not using pricing information. First, while
tariff-specific price *changes* may be calculated, pre- and post-tariff
price *levels* cannot. Second, welfare measures like
compensating variation cannot be calculated. Prices are an optional
input to `aids`

and `pcaids`

, and when they are supplied both
price levels and welfare measures may be calculated.

Another model included in `trade`

is the Cournot quantity game. This version of the game assumes that multi-plant firms with distinct, increasing marginal costs producing multiple products
simultaneously set plant output for each product to maximize their
profits.^{11} All firms producing a particular product are assumed to be undifferentiated. In this model, quantities are *strategic substitutes* in the sense that decreasing the quantity of
one product causes some customers to switch to competing manufacturers, raising
their quantities and profits. Ultimately, it is the magnitude of these lost sales that, at
the margin, dissuades firms from reducing their output further .

Similar to the Bertrand model, tariffs are modeled by effectively assuming that the marginal costs
of certain products produced by
foreign firms increase by the amount of the tariff. Because all plants included in `trade`

models are assumed
to be producing substitutes, this marginal cost increase
causes foreign firms to restrict plant output, which in turn raises product price.

Because all firms are manufacturing an identical version of the product, this version of the Cournot model allows firms under the new tariff regime to start or stop producing other products. This model does not allow for firms to engage in some forms of price discrimination.^{12}

Suppose that there are \(K\) firms in a
market, each producing a subset \(J_k\) of \(J\) products. Further, suppose that that each of the \(k \in K\) firms manufactures its \(J_k\) products at \(n_k\)
plants. Let \(n = \sum_{k\in K} n_k\) denote the total number of plants producing any of the \(J\) products. The Cournot model assumes that firms
simultaneously set the amount of each product produced at each plant in order to maximize
their profits. This model also assumes that all firms can perfectly observe each
others’ quantities, and costs, as well as the demand for each product. Further, suppose that the government imposes an *ad valorem* tariff \(t_i\) on a subset of products produced at plants located abroad. Note that we assume that the tariff is calculated as a proportion of **consumer** price, so that the price received by the firm is \(1-t_i\) the price faced by consumers.

Functions in `trade`

’s Cournot model also adopt the additional assumption that each firm’s plant has its own distinct marginal cost
technology.

Firm \(k \in K\) chooses product output at each plant \(\{q_j^r\}_{\substack{j\in j_k,\\ r\in n_k}}\), $ so as to maximize profits. Mathematically, firm \(k\) solves:

\[\begin{align*} \max_{{\{q_j^r\}}_{\substack{j\in J_k,\\ r\in n_k}}} & \sum_{\substack{j\in J_k,\\ r\in n_k}}p_jq_j^r(1-t_j^r) - \sum_{r\in n_k}c^r(q^r) \end{align*}\] subject to \[\begin{align*} & q_j^r \ge 0,&\\ & q^r = \sum_{j \in J_k} q_j^r &\\ \end{align*}\]

where \(p_j\), the price sold of product \(j\), is assumed to
be a twice differentiable function of *all* firm quantities with \(\frac{\partial p_j}{\partial q_j^r}< 0\) for all plants \(r\) and products \(j\). Likewise, additively separable plant variable costs \(c^r\) assumed to be twice differentiable with \(\frac{\partial c^r}{\partial q_j^r}> 0\) . Finally, \(t_j^r\) is the tariff imposed on plant \(r\) producing product \(j\).

Differentiating profits with respect to each \(q_j^r\) yields the following first order conditions (FOCs):

\[\begin{align} \partial q_j^r&\equiv p_j + \sum_{l\in n_k}q_j^l\frac{\partial p_j}{\partial q_j^r} - \frac{\partial c^r}{\partial q_j^r}\frac{1}{1-t_j^r}=0& \mbox{ for all $j\in J_k$, $r\in n_k$}\label{eqn:cournotFOC} \end{align}\]

The Cournot model can yield different equilibrium quantity and price predictions depending on 1) the curvature of plant variable costs and 2) the curvature of demand. `trade`

allows users to explore the consequences of different cost and demand assumptions.

Currently, `cournot`

contains two different ways to specify plant costs. First, users can set the ‘cost’ option equal to a \(n\)-length character vector whose values are either equal to “linear” for linear marginal costs (\(\frac{\partial c^r}{\partial q_j^r}= 0.5\gamma_r\sum_{j\in n_r}q_j^r\)) or “constant” for constant marginal costs (\(\frac{\partial c^r}{\partial q_j^r}= \gamma_r\)) . When the ‘cost’ option is employed, `cournot`

’s `calcSlopes`

method uses observed costs (implied by predicted margins and prices) and prices to calibrate plant-level cost parameters \(\gamma_r\).

Alternatively, users can specify both plant level marginal and variable costs. Marginal costs may be specified by setting the ‘mcfunPre’ argument equal to a length \(n\) list of functions that each take as an input the vector of product quantities produced at a plant and then return the marginal cost associated with producing that level of output at that plant. Likewise, the ‘vcfunPre’ argument can be similarly used to specify plant-level variable costs. Note that when marginal costs and variable costs are specified in this manner, `cournot`

makes no attempt to calibrate any parameters on the cost side.

Currently, `cournot`

allows users to specify that product demand is either linear (\(p_j=b_j + a_j\sum_{k\in n}q_j^k\)) or log-linear (\(\ln(p_j)=b_j + a_j\ln(\sum_{k\in n}q_j^k)\)) Users can specify product demand by setting `cournot`

‘s `demand’ argument equal to a \(j\)-length character vector equal to either “linear” for linear demand or “log” for log-linear demand.

`trade`

’s version of the Bertrand pricing game extends (**???**) and (**???**) to accommodate tariffs under Bertrand price competition.↩Specifically, the curvature of the demand curve greatly influences the results.↩

Throughout, we abuse the notation slightly by treating variables like \(K\) as both the set of firms as well as the number of firms.↩

This section is based on the model described in (

**???**)↩The outside good is a nuisance parameter because it is only needed to obtain estimates of the other demand and cost parameters and is not used to solve for equilibrium prices.↩

Formally, each consumer chooses the product \(i \in I\) that yields the maximum utility \(U_i=\ln(\delta_iq_i) +\alpha \ln(q_0) + \epsilon_i\), subject to the budget constraint \(y=p_iq_i+q_0\). Here, \(q_i\) is the amount of product \(i\) consumed by a consumer, \(\delta_i\) is a measure of product \(i\)’s quality, \(q_0\) is the amount of the numeraire, \(y\) is consumer income, and \(\epsilon_i\) are random variables independently and identically distributed according to the Type I Extreme Value distribution.↩

LA-AIDS differs from AIDS in that LA-AIDS substitutes the AIDS price index with Stone’s price index. Since this version of LA-AIDS is without income effects, Stone’s price index is only used to derive the own- and cross-price elasticities.↩

If the ‘diversion’ argument to

`bertrand_tariff`

is missing,`bertrand_tariff`

assumes diversion according to revenue share.↩In fact, it turns out that only one element of \(B\) must be estimated.To see why, note that under symmetry, \(\beta_{jj}=\frac{d_{ij}}{d_{ji}}\beta_{ii}\). Hence, if \(\beta_{ii}\) is known, then the preceding equation indicates that all the \(\beta_{jj}\)s may be recovered. From here, the definition of diversion may be used to recover all the \(\beta_{ij}s\).↩

This assumption implies that customers substitute to products outside of the simulation in response to price increases by all products in the simulation at the same rate before and after the change in tariffs. ↩

`trade`

’s version of the Cournot quantity game extends (**???**) to accommodate tariffs under Cournot quantity competition.↩In particular, this version of the Bertrand model does not accommodate non-linear pricing, such as is used in 2nd or 3rd degree price discrimination.↩