Package 'trade'

Title: Tools for Trade Practitioners
Description: A collection of tools for trade practitioners, including the ability to calibrate different consumer demand systems and simulate the effects of tariffs and quotas under different competitive regimes. These tools are derived from Anderson et al. (2001) <doi:10.1016/S0047-2727(00)00085-2> and Froeb et al. (2003) <doi:10.1016/S0304-4076(02)00166-5>.
Authors: Charles Taragin [aut, cre]
Maintainer: Charles Taragin <[email protected]>
License: CC0
Version: 0.9.0
Built: 2026-11-10 05:55:29 UTC
Source: https://github.com/luciu5/trade

Help Index


Re-exported antitrust diagnostics and accessors

Description

These functions are implemented in antitrust and re-exported by trade because they are useful for inspecting calibrated tariff and quota simulations.

Usage

calcPriceDelta(
  object,
  levels = FALSE,
  market = FALSE,
  party = FALSE,
  isMax = FALSE,
  index = c("paasche", "laspeyres"),
  ...
)

calcShares(object, ...)

calcRevenues(object, ...)

calcMC(object, ...)

CV(object, ...)

elast(object, ...)

diversion(object, ...)

calcDiagnostics(object, ...)

ownerToMatrix(object, ...)

ownerToVec(object, ...)

final_result(path)

result_at(path, i)

add_step(object, ...)

Arguments

object

An instance of a supported simulation class.

levels

If TRUE, report changes in levels. If FALSE, report proportional changes.

market

If TRUE, report a market-level result when supported.

party

If TRUE, report a party-level result when supported.

isMax

If TRUE, run the underlying local maximum check when supported.

index

Price index to use for aggregate price changes.

...

Additional arguments passed to the underlying antitrust method.

path

A 'CounterfactualPath' object.

i

A single step index, for 'result_at()'.


Promote a fitted antitrust model into a trade model

Description

as_trade_fit() creates a policy-aware TradeFit from a fitted AntitrustFit. The demand and conduct state is copied from the source fit. Promotion does not recalibrate demand or solve an equilibrium.

Usage

as_trade_fit(object, policy = "tariff", ...)

## S4 method for signature 'AntitrustFit'
as_trade_fit(object, policy = "tariff", ...)

## S4 method for signature 'StructuralFit'
as_trade_fit(object, policy = "tariff", ...)

## S4 method for signature 'StackelbergLogit'
as_trade_fit(object, policy = "tariff", ...)

## S4 method for signature 'StackelbergCES'
as_trade_fit(object, policy = "tariff", ...)

## S4 method for signature 'CoreFringeLogit'
as_trade_fit(object, policy = "tariff", ...)

## S4 method for signature 'CoreFringeCES'
as_trade_fit(object, policy = "tariff", ...)

Arguments

object

A fitted AntitrustFit, or a StructuralFit for the fallback error method.

policy

The registered trade policy family, currently "tariff" or "quota".

...

The baseline policy state. Tariff models accept tariffPre, defaulting to zero; the Logit quota model accepts quotaPre, defaulting to Inf (unconstrained). The post-policy state is initialized to the same value. The explicit tariff-reuse route also accepts entrant_tariff, a finite scalar below one (default zero), for new products that do not declare their own tariff.

Details

Eligibility requires the exact normalized demand, conduct, and variant in both packages' supportedModels() registries, under the requested trade policy. Source parameters, fitted model slots, integration state, ownership, and baseline equilibrium are preserved. Post-policy slots are initialized to the source baseline; use simulate() to solve a subsequent policy change.

Tariffs use a product vector except for Linear and LogLin Cournot models, which require a plant-by-product matrix matching the fitted quantities. A numeric scalar expands to the required dimensions. Product tariffs must be finite and less than one, including matrix tariffs. Finite negative tariffs represent subsidies. Missing tariff entries become zero.

Quotas are non-negative multiples of fitted baseline output. Missing quota entries become Inf. A quota below one is incompatible with the copied baseline for a product with positive fitted output and is rejected. Unsupported or irrelevant policy arguments are rejected.

For an ordinary output Logit/CES or standard output Logit second-score auction AntitrustFit, explicitly supplying cost_basis, margin_basis, or entrant_tariff opts into the no-reestimation tariff route and returns a TariffGameFit. A nonzero tariffPre requires cost_basis = "effective" and margin_basis = "net_revenue"; an all-zero baseline can infer those two values. Tariffs use the consumer-price fraction convention, must be finite and less than one. Relative to saved source retention, baseline retention may change only by a constant within each active strategic firm. Physical-cost basis is not supported in this initial route. Calls without either contract flag retain the historical promotion behavior.

Value

A TradeFit containing the copied source model and policy state.

Examples

source_fit <- antitrust::specify(
  "logit", "bertrand", prices = c(2, 2.2, 2.5),
  parameters = list(alpha = -1.5, meanval = c(1, 0.8, 1.2)),
  ownerPre = diag(3), insideSize = 100
)
policy_fit <- as_trade_fit(source_fit, tariffPre = 0)
policy_fit@model@pricePre
source_fit@model@pricePre

Tariff Simulation With A Second Score Procurement Auction Game

Description

Simulate the effect of tariffs when firms play a second score procurement auction game and consumer demand is Logit.

Usage

auction2nd_tariff(
  demand = c("logit"),
  prices,
  quantities,
  margins,
  owner = NULL,
  mktElast = NA_real_,
  diversions,
  tariffPre = rep(0, length(quantities)),
  tariffPost = rep(0, length(quantities)),
  priceStart,
  parmStart,
  control.slopes,
  control.equ,
  labels = paste("Prod", 1:length(quantities), sep = ""),
  ...
)

Arguments

demand

A character vector indicating which demand system to use. Currently allows logit (default).

prices

A length k vector product prices.

quantities

A length k vector of product quantities.

margins

A length k vector of product margins. All margins must be in levels (not w.r.t to price), or NA.

owner

Required. EITHER a vector of length k whose values indicate which firm produced a product before the tariff OR a k x k matrix of pre-tariff ownership shares.

mktElast

A negative number equal to the industry pre-merger price elasticity. Default is NA .

diversions

A k x k matrix of diversion ratios with diagonal elements equal to -1. Default is missing, in which case diversion according to revenue share is assumed.

tariffPre

A vector of length k where each element equals the current ad valorem tariff (expressed as a proportion of the consumer price) imposed on each product. Default is 0, which assumes no tariff.

tariffPost

A vector of length k where each element equals the new ad valorem tariff (expressed as a proportion of the consumer price) imposed on each product. Default is 0, which assumes no tariff.

priceStart

A vector of length k whose elements equal initial guesses for prices. When omitted, valid pre-merger 'prices' are used.

parmStart

A vector of starting values for demand calibration.

control.slopes

A list of optim control parameters passed to the calibration routine optimizer (typically the calcSlopes method).

control.equ

A list of BBsolve control parameters passed to the non-linear equation solver (typically the calcPrices method).

labels

A k-length vector of labels.

...

Additional options to feed to the BBsolve optimizer used to solve for equilibrium prices.

Details

Native one-offer-per-firm bidding and product-choice rules are preserved. Tariffs must be uniform within each firm's active product portfolio. Mixed-tariff portfolios are rejected pending a separate bidding-equilibrium extension; tariffs may differ across firms.

Let k denote the number of products produced by all firms. Using price, and quantity, information for all products in each market, as well as margin information for at least one products in each market, auction2nd_tariff is able to recover the slopes and intercepts of a Logit demand system. These parameters are then used to simulate the price effects of an ad valorem tariff under the assumption that the firms are playing a 2nd score auction.

Value

auction2nd_tariff returns an instance of class Tariff2ndLogit

References

Simon P. Anderson, Andre de Palma, Brent Kreider, Tax incidence in differentiated product oligopoly, Journal of Public Economics, Volume 81, Issue 2, 2001, Pages 173-192.

See Also

bertrand_tariff to simulate the effects of a tariff under a Bertrand pricing game and monopolistic_competition_tariff to simulate the effects of a tariff under monopolistic competition.

Examples

## Calibration and simulation results from a 10% tariff on non-US beers "OTHER-LITE"
## and "OTHER-REG"
## Source: Epstein/Rubenfeld 2004, pg 80

prodNames <- c("BUD","OLD STYLE","MILLER","MILLER-LITE","OTHER-LITE","OTHER-REG")
owner <-c("BUD","OLD STYLE","MILLER","MILLER","OTHER-LITE","OTHER-REG")
price    <- c(.0441,.0328,.0409,.0396,.0387,.0497)
quantities   <- c(.066,.172,.253,.187,.099,.223)*100
margins <- c(.3830,.5515,.5421,.5557,.4453,.3769) # margins in terms of price
margins <- margins*price # dollar margins
tariff <- c(0,0,0,0,.1,.1)

names(price) <-
 names(quantities) <-
 names(margins) <-
 prodNames


result.2nd <- auction2nd_tariff(demand = "logit",prices=price,quantities=quantities,
                                margins = margins,owner=owner,
                                 tariffPost = tariff, labels=prodNames)

print(result.2nd)           # return predicted price change
summary(result.2nd)         # summarize merger simulation

Tariff Simulation With A Nash Bargaining Game

Description

Simulate the effect of tariffs when firms play a Nash Bargaining game and consumer demand is Logit or CES.

Usage

bargaining_tariff(
  demand = c("logit", "ces"),
  prices,
  shares,
  margins,
  owner = NULL,
  mktElast = NA_real_,
  insideSize = NA_real_,
  diversions,
  tariffPre = rep(0, length(shares)),
  tariffPost = rep(0, length(shares)),
  bargpowerPre = rep(0.5, length(prices)),
  bargpowerPost = bargpowerPre,
  normIndex = ifelse(isTRUE(all.equal(sum(shares), 1, check.names = FALSE)), 1, NA),
  priceOutside = ifelse(demand == "logit", 0, 1),
  priceStart,
  control.slopes,
  control.equ,
  labels = paste("Prod", 1:length(shares), sep = ""),
  ...
)

Arguments

demand

A character vector indicating which demand system to use. Currently allows logit (default) or ces.

prices

A length k vector product prices.

shares

A length k vector of product shares. Values must be between 0 and 1.

margins

A length k vector of product margins. All margins must be in levels (not w.r.t to price), or NA.

owner

Required. EITHER a vector of length k whose values indicate which firm produced a product before the tariff OR a k x k matrix of pre-tariff ownership shares.

mktElast

A negative number equal to the industry pre-merger price elasticity. Default is NA .

insideSize

An integer equal to total pre-merger units sold. If shares sum to one, this also equals the size of the market.

diversions

A k x k matrix of diversion ratios with diagonal elements equal to -1. Default is missing, in which case diversion according to revenue share is assumed.

tariffPre

A vector of length k where each element equals the current ad valorem tariff (expressed as a proportion of the consumer price) imposed on each product. Default is 0, which assumes no tariff.

tariffPost

A vector of length k where each element equals the new ad valorem tariff (expressed as a proportion of the consumer price) imposed on each product. Default is 0, which assumes no tariff.

bargpowerPre

A length k vector of pre-tariff bargaining power parameters. Values must be between 0 (sellers have the power) and 1 (buyers the power). NA values are allowed, though must be calibrated from additional margin and share data. Default is 0.5.

bargpowerPost

A length k vector of post-tariff bargaining power parameters. Values must be between 0 (sellers have the power) and 1 (buyers the power). NA values are allowed, though must be calibrated from additional margin and share data. Default is ‘bargpowerPre’.

normIndex

An integer equalling the index (position) of the inside product whose mean valuation will be normalized to 1. Default is 1, unless ‘shares’ sum to less than 1, in which case the default is NA and an outside good is assumed to exist.

priceOutside

price of the outside good. Equals 0 for logit and 1 for ces. Not used for aids.

priceStart

For aids, a vector of length k who elements equal to an initial guess of the proportional change in price caused by the merger. The default is to draw k random elements from a [0,1] uniform distribution. For ces and logit, the default is prices.

control.slopes

A list of optim control parameters passed to the calibration routine optimizer (typically the calcSlopes method).

control.equ

A list of BBsolve control parameters passed to the non-linear equation solver (typically the calcPrices method).

labels

A k-length vector of labels.

...

Additional options to feed to the BBsolve optimizer used to solve for equilibrium prices.

Details

Let k denote the number of products produced by all firms. Using price, and quantity, information for all products in each market, as well as margin information for at least one products in each market, bargaining_tariff is able to recover the slopes and intercepts of a Logit or CES demand system. These parameters are then used to simulate the price effects of an ad valorem tariff under the assumption that the firms are playing a Nash Bargaining game. Tariffs affect seller revenue through retention rates 1−τ1-\tau; the ownership matrices continue to represent the firms' actual ownership shares.

Value

bargaining_tariff returns an instance of class TariffBargainingLogit or TariffBargainingCES

References

Simon P. Anderson, Andre de Palma, Brent Kreider, Tax incidence in differentiated product oligopoly, Journal of Public Economics, Volume 81, Issue 2, 2001, Pages 173-192.

See Also

bertrand_tariff to simulate the effects of a tariff under a Bertrand pricing game and monopolistic_competition_tariff to simulate the effects of a tariff under monopolistic competition.


quota Simulation With A Bertrand Pricing Game

Description

Simulate the effect of quotas when firms play a Bertrand pricing game and consumer demand is Logit.

Usage

bertrand_quota(
  demand = c("logit"),
  prices,
  quantities,
  margins,
  owner = NULL,
  mktElast = NA_real_,
  diversions,
  quotaPre = rep(Inf, length(quantities)),
  quotaPost = rep(Inf, length(quantities)),
  priceOutside = ifelse(demand == "logit", 0, 1),
  priceStart,
  isMax = FALSE,
  parmStart,
  control.slopes,
  control.equ,
  labels = paste("Prod", 1:length(quantities), sep = ""),
  ...
)

Arguments

demand

A character vector indicating which demand system to use. Currently allows logit (default).

prices

A length k vector product prices. Default is missing, in which case demand intercepts are not calibrated.

quantities

A length k vector of product quantities.

margins

A length k vector of product margins. All margins must be either be between 0 and 1, or NA.

owner

Required. EITHER a vector of length k whose values indicate which firm produced a product before the quota OR a k x k matrix of pre-quota ownership shares.

mktElast

A negative number equal to the industry pre-merger price elasticity. Default is NA .

diversions

A k x k matrix of diversion ratios with diagonal elements equal to -1. Default is missing, in which case diversion according to revenue share is assumed.

quotaPre

A vector of length k where each element equals the current quota (expressed as a proportion of pre-merger quantities) imposed on each product. Default is Inf, which assumes no quota.

quotaPost

A vector of length k where each element equals the new quota (expressed as a proportion of pre-merger quantities) imposed on each product. Default is Inf, which assumes no quota.

priceOutside

price of the outside good. Equals 0 for logit.

priceStart

A vector of length k whose elements equal initial guesses for prices.

isMax

If TRUE, checks to see whether computed price equilibrium locally maximizes firm profits and returns a warning if not. Default is FALSE.

parmStart

A vector of starting values for demand calibration.

control.slopes

A list of optim control parameters passed to the calibration routine optimizer (typically the calcSlopes method).

control.equ

A list of BBsolve control parameters passed to the non-linear equation solver (typically the calcPrices method).

labels

A k-length vector of labels.

...

Additional options to feed to the BBsolve optimizer used to solve for equilibrium prices.

Details

Let k denote the number of products produced by all firms. Using price, and quantity, information for all products in each market, as well as margin information for at least one products in each market, bertrand_quota is able to recover the slopes and intercepts of the Logit, demand system. These parameters are then used to simulate the price effects of a quota under the assumption that the firms are playing a simultaneous price setting game.

Value

bertrand_quota returns an instance of class QuotaLogit.

References

Simon P. Anderson, Andre de Palma, Brent Kreider, Tax incidence in differentiated product oligopoly, Journal of Public Economics, Volume 81, Issue 2, 2001, Pages 173-192.

Examples

## Calibration and simulation results from a 80% quota on non-US beers "OTHER-LITE"
## and "OTHER-REG"
## Source: Epstein/Rubenfeld 2004, pg 80

prodNames <- c("BUD","OLD STYLE","MILLER","MILLER-LITE","OTHER-LITE","OTHER-REG")
owner <-c("BUD","OLD STYLE","MILLER","MILLER","OTHER-LITE","OTHER-REG")
price    <- c(.0441,.0328,.0409,.0396,.0387,.0497)
quantities   <- c(.066,.172,.253,.187,.099,.223)*100
margins <- c(.3830,.5515,.5421,.5557,.4453,.3769)
quota <- c(Inf,Inf,Inf,Inf,.8,.8)

names(price) <-
 names(quantities) <-
 names(margins) <-
 prodNames


result.logit <- bertrand_quota(demand = "logit",prices=price,quantities=quantities,
                                margins = margins,owner=owner, quotaPost = quota, labels=prodNames)

print(result.logit)           # return predicted price change
summary(result.logit)         # summarize merger simulation

Tariff Simulation With A Bertrand Pricing Game

Description

Simulate the effect of tariffs when firms play a Bertrand pricing game and consumer demand is either Logit, CES, or AIDS

Usage

bertrand_tariff(
  demand = c("logit", "ces", "aids"),
  prices,
  quantities,
  margins,
  owner = NULL,
  mktElast = NA_real_,
  diversions,
  tariffPre = rep(0, length(quantities)),
  tariffPost = rep(0, length(quantities)),
  priceOutside = ifelse(demand == "logit", 0, 1),
  priceStart,
  isMax = FALSE,
  parmStart,
  control.slopes,
  control.equ,
  labels = paste("Prod", 1:length(quantities), sep = ""),
  ...
)

Arguments

demand

A character vector indicating which demand system to use. Currently allows logit (default), ces, or aids.

prices

A length k vector product prices. Default is missing, in which case demand intercepts are not calibrated.

quantities

A length k vector of product quantities.

margins

A length k vector of product margins. All margins must be either be between 0 and 1, or NA.

owner

Required. EITHER a vector of length k whose values indicate which firm produced a product before the tariff OR a k x k matrix of pre-tariff ownership shares.

mktElast

A negative number equal to the industry pre-merger price elasticity. Default is NA .

diversions

A k x k matrix of diversion ratios with diagonal elements equal to -1. Default is missing, in which case diversion according to revenue share is assumed.

tariffPre

A vector of length k where each element equals the current ad valorem tariff (expressed as a proportion of the consumer price) imposed on each product. Default is 0, which assumes no tariff.

tariffPost

A vector of length k where each element equals the new ad valorem tariff (expressed as a proportion of the consumer price) imposed on each product. Default is 0, which assumes no tariff.

priceOutside

price of the outside good. Equals 0 for logit and 1 for ces. Not used for aids.

priceStart

For aids, a vector of length k whose elements are initial guesses for log price changes, defaulting to zero. For ces and logit, the default is prices.

isMax

If TRUE, checks to see whether computed price equilibrium locally maximizes firm profits and returns a warning if not. Default is FALSE.

parmStart

aids only. A vector of length 2 whose elements equal to an initial guess for each "known" element of the diagonal of the demand matrix and the market elasticity.

control.slopes

A list of optim control parameters passed to the calibration routine optimizer (typically the calcSlopes method).

control.equ

A list of BBsolve control parameters passed to the non-linear equation solver (typically the calcPrices method).

labels

A k-length vector of labels.

...

Additional options to feed to the BBsolve optimizer used to solve for equilibrium prices.

Details

Let k denote the number of products produced by all firms. Using price, and quantity, information for all products in each market, as well as margin information for at least one products in each market, bertrand_tariff is able to recover the slopes and intercepts of either a Logit, CES, or AIDS demand system. These parameters are then used to simulate the price effects of an ad valorem tariff under the assumption that the firms are playing a simultaneous price setting game.

Value

bertrand_tariff returns an instance of class TariffLogit, TariffCES, or TariffAIDS, depending upon the value of the “demand” argument.

References

Simon P. Anderson, Andre de Palma, Brent Kreider, Tax incidence in differentiated product oligopoly, Journal of Public Economics, Volume 81, Issue 2, 2001, Pages 173-192.

See Also

monopolistic_competition_tariff to simulate the effects of a tariff under monopolistic competition.

Examples

## Calibration and simulation results from a 10% tariff on non-US beers "OTHER-LITE"
## and "OTHER-REG"
## Source: Epstein/Rubenfeld 2004, pg 80

prodNames <- c("BUD","OLD STYLE","MILLER","MILLER-LITE","OTHER-LITE","OTHER-REG")
owner <-c("BUD","OLD STYLE","MILLER","MILLER","OTHER-LITE","OTHER-REG")
price    <- c(.0441,.0328,.0409,.0396,.0387,.0497)
quantities   <- c(.066,.172,.253,.187,.099,.223)*100
margins <- c(.3830,.5515,.5421,.5557,.4453,.3769)
tariff <- c(0,0,0,0,.1,.1)

names(price) <-
 names(quantities) <-
 names(margins) <-
 prodNames


result.logit <- bertrand_tariff(demand = "logit",prices=price,quantities=quantities,
                                margins = margins,owner=owner,
                                 tariffPost = tariff, labels=prodNames)

print(result.logit)           # return predicted price change
summary(result.logit)         # summarize merger simulation
calcDiagnostics(result.logit) # compare calibrated and observed inputs

Combine non-conflicting counterfactual changes into one simultaneous step

Description

'combine_counterfactuals()' merges the single steps of several one-step 'Counterfactual' objects into one simultaneous 'CounterfactualStep', erroring if any field is supplied with conflicting values. Combining multi-step 'Counterfactual' objects is ambiguous and is rejected explicitly; use 'add_step()' to sequence changes instead.

Usage

combine_counterfactuals(...)

Arguments

...

'Counterfactual' objects, each with exactly one step.

Value

A one-step 'Counterfactual'.


Define a post-calibration trade-policy counterfactual

Description

'counterfactual()' stores only supplied changes to the economic environment, bundled as the single 'CounterfactualStep' of a 'Counterfactual'. Demand, conduct, and model variants are deliberately not counterfactual fields; use 'update()' or 'respecify()' for those changes. Use 'add_step()' to append further, sequential steps.

Usage

counterfactual(
  ownership = NULL,
  costs = NULL,
  exit = NULL,
  capacity = NULL,
  tariff = NULL,
  quota = NULL,
  bargaining = NULL,
  leader = NULL,
  products = NULL,
  quality = NULL,
  entry = NULL,
  core = NULL,
  ...
)

Arguments

ownership

Ownership changes, unsupported unless registered.

costs

Cost changes, unsupported unless registered.

exit

Products to remove, or a logical active-product vector.

capacity

Capacity changes, unsupported unless registered.

tariff

A post-counterfactual tariff vector.

quota

A post-counterfactual quota vector.

bargaining

Bargaining-parameter changes, unsupported unless registered.

leader

Leader changes, unsupported unless registered.

products

Product-structure changes, unsupported unless registered.

quality

A named numeric vector of proportional attractiveness changes keyed by product label. Logit adds 'log1p(quality)' to the utility; CES multiplies its positive mean-value weight by '1 + quality'. Verified for every registered trade model whose legacy class wraps a Logit/CES-family antitrust demand system (moncom, tariff Bertrand/Cournot, second-score auction, bargaining, and LogitCap-descended quota); unsupported for AIDS and linear/loglin Cournot tariff models, which have no 'meanval'.

entry

An entrant specification. Entry is available through the explicit 'TariffGameFit' route for its implemented ordinary output models; historical 'TradeFit', quota, and native coordination entry remain unsupported. Entrant extra ‘tariff' overrides the fit’s 'entrant_tariff' default, and a simultaneous 'tariff' field overrides both.

core

Core-firm IDs for native CoreFringe tariff games.

...

Reserved; model specification fields are rejected.

Value

A 'Counterfactual' object with exactly one 'CounterfactualStep'.


Tariff Simulation With A Cournot Quantity Setting Game

Description

Simulate the effect of tariffs when firms play a cournot quantity setting game and consumer demand is either linear or log-linear

Usage

cournot_tariff(
  prices,
  quantities,
  margins = matrix(NA_real_, nrow(quantities), ncol(quantities)),
  demand = rep("linear", length(prices)),
  cost = rep("linear", nrow(quantities)),
  tariffPre = matrix(0, nrow = nrow(quantities), ncol = ncol(quantities)),
  tariffPost = tariffPre,
  mcfunPre = list(),
  mcfunPost = mcfunPre,
  vcfunPre = list(),
  vcfunPost = vcfunPre,
  capacitiesPre = rep(Inf, nrow(quantities)),
  capacitiesPost = capacitiesPre,
  productsPre = !is.na(quantities),
  productsPost = productsPre,
  owner = NULL,
  mktElast = rep(NA_real_, length(prices)),
  quantityStart = as.vector(quantities),
  control.slopes,
  control.equ,
  labels,
  ...
)

Arguments

prices

A length k vector product prices.

quantities

An n x k matrix of product quantities. All quantities must either be positive, or if the product is not produced by a plant, NA

margins

An n x k matrix of product margins relative to net seller revenue. All margins must either be between 0 and 1, or NA.

demand

A length k character vector equal to "linear" if a product's demand curve is assumed to be linear or "log" if a product's demand curve is assumed to be log-linear.

cost

A length k character vector equal to "linear" if a plant's marginal cost curve is assumed to be linear or "constant" if a plant's marginal curve is assumed to be constant. Returns an error if a multi-plant firm with constant marginal costs does not have capacity constraints.

tariffPre

An n x k matrix where each element equals the current ad valorem tariff (expressed as a proportion of consumer price) imposed on each product. Default is 0, which assumes no tariff.

tariffPost

An n x k matrix where each element equals the new ad valorem tariff (expressed as a proportion of consumer price) imposed on each product. Default is 0, which assumes no tariff.

mcfunPre

a length n list of functions that calculate a plant's marginal cost under the current tariff structure. If empty (the default), assumes quadratic costs.

mcfunPost

a length n list of functions that calculate a plant's marginal cost under the new tariff structure. If empty (the default), assumes quadratic costs.

vcfunPre

a length n list of functions that calculate a plant's variable cost under the current tariff structure. If empty (the default), assumes quadratic costs.

vcfunPost

a length n list of functions that calculate a plant's variable cost under the new tariff structure. If empty (the default), assumes quadratic costs.

capacitiesPre

A length n numeric vector of plant capacities under the current tariff regime. Default is Inf.

capacitiesPost

A length n numeric vector of plant capacities under the new tariff regime. Default is Inf.

productsPre

An n x k matrix that equals TRUE if under the current tariff regime, a plant produces a product. Default is TRUE if 'quantities' is not NA.

productsPost

An n x k matrix that equals TRUE if under the new tariff regime, a plant produces a product. Default equals 'productsPre'.

owner

Required. EITHER a vector of length n whose values indicate which plants are commonly owned OR an n x n matrix of ownership shares.

mktElast

A length k vector of product elasticities. Default is a length k vector of NAs

quantityStart

A length k vector of quantities used as the initial guess in the nonlinear equation solver. Default is 'quantities'.

control.slopes

A list of optim control parameters passed to the calibration routine optimizer (typically the calcSlopes method).

control.equ

A list of BBsolve control parameters passed to the non-linear equation solver (typically the calcPrices method).

labels

A k-length vector of labels.

...

Additional options to feed to the BBsolve optimizer used to solve for equilibrium quantities.

Details

Let k denote the number of products and n denote the number of plants. Using price, and quantity, information for all products in each market, as well as margin information for at least one products in each market, cournot_tariff is able to recover the slopes and intercepts of either a Linear or Log-linear demand system. These parameters are then used to simulate the price effects of a tariff under the assumption that the firms are playing a homogeneous products simultaneous quantity setting game.

An ad valorem tariff rate τik\tau_{ik} gives plant ii a seller retention of 1−τik1-\tau_{ik} on product kk. Baseline physical marginal cost is calibrated as pk(1−mik)(1−τik)p_k(1-m_{ik})(1-\tau_{ik}). At an equilibrium, a producing plant's marginal revenue in its quantity-setting first-order condition is (1−τik)pk+pk′∑hohi(1−τhk)qhk(1-\tau_{ik})p_k + p'_k\sum_h o_{hi}(1-\tau_{hk})q_{hk}, where ohio_{hi} is the ownership share. Outputs satisfy non-negativity and the supplied plant capacity constraints.

Value

cournot_tariff returns an instance of Cournot-class from package antitrust, depending upon the value of the “demand” argument.

References

Simon P. Anderson, Andre de Palma, Brent Kreider, The efficiency of indirect taxes under imperfect competition, Journal of Public Economics, Volume 81, Issue 2, 2001,Pages 231-251.

Examples

## Simulate the effect of a 75% ad valorem tariff in a
## 5-firm, single-product market with linear demand and quadratic costs
## Firm 1 is assumed to be foreign, and so subject to a tariff


n <- 5 #number of firms in market
cap <- rnorm(n,mean = .5, sd = .1)
int <- 10
slope <- -.25
tariffPre <- tariffPost <- rep(0, n)
tariffPost[1] <- .75

B.pre.c = matrix(slope,nrow=n,ncol=n)
diag(B.pre.c) = 2* diag(B.pre.c) - 1/cap
quantity.pre.c = rowSums(solve(B.pre.c) * -int)
price.pre.c = int + slope * sum(quantity.pre.c)
mc.pre.c = quantity.pre.c/cap
vc.pre.c = quantity.pre.c^2/(2*cap)
margin.pre.c = 1 - mc.pre.c/price.pre.c

#prep inputs for Cournot
owner.pre <- diag(n)



result.c <- cournot_tariff(prices = price.pre.c,quantities = as.matrix(quantity.pre.c),
                    margins=as.matrix(margin.pre.c),
                    owner=owner.pre,
                    tariffPre =  as.matrix(tariffPre),
                    tariffPost = as.matrix(tariffPost))

summary(result.c, market = TRUE)         # summarize tariff (high-level)
summary(result.c, market = FALSE)         # summarize tariff (detailed)

Methods For Implementing The Hypothetical Monopolist Test

Description

An adaptation of the Hypothetical Monopolist Test described in the 2010 Horizontal Merger Guidelines for use in non-merger settings.

HypoMonTest implements the Hypothetical Monopolist Test for a given ‘ssnip’. ‘...’ may be used to pass arguments to the optimizer.

Usage

## S4 method for signature 'TariffBertrand'
HypoMonTest(object, prodIndex, ssnip = 0.05, ...)

## S4 method for signature 'TariffCournot'
HypoMonTest(object, plantIndex, prodIndex, ssnip = 0.05, ...)

Arguments

object

An instance of one of the classes listed above.

prodIndex

A vector of product indices that are to be placed under the control of the Hypothetical Monopolist.

ssnip

A number between 0 and 1 that equals the threshold for a “Small but Significant and Non-transitory Increase in Price” (SSNIP). Default is .05, or 5%.

...

Pass options to the optimizer used to solve for equilibrium prices.

plantIndex

A vector of plant indices that are to be placed under the control of the Hypothetical Monopolist (Cournot).

Details

HypoMonTest is an implementation of the Hypothetical Monopolist Test on the products indexed by ‘prodIndex’ for a ‘ssnip’. The Hypothetical Monopolist Test determines whether a profit-maximizing Hypothetical Monopolist who controls the products indexed by ‘prodIndex’ would increase the price of at least one of the products in ‘prodIndex’ by a small, significant, and non-transitory amount (i.e. impose a SSNIP). The main difference between this implementation and HypoMonTest is this implementation does not check to see if ‘prodIndex’ contains a merging party's product.

Value

HypoMonTest returns TRUE if a profit-maximizing Hypothetical Monopolist who controls the products indexed by ‘prodIndex’ would increase the price of at least one of the products in ‘prodIndex’ by a ‘ssnip’, and FALSE otherwise.

References

U.S. Department of Justice and Federal Trade Commission, Horizontal Merger Guidelines. Washington DC: U.S. Department of Justice, 2010. https://www.justice.gov/atr/horizontal-merger-guidelines-08192010 (accessed July 29, 2011).


Initialize Methods

Description

Initialize methods for the TariffBertrand and TariffCournot classes

Usage

## S4 method for signature 'TariffBertrand'
initialize(.Object, ...)

## S4 method for signature 'QuotaBertrand'
initialize(.Object, ...)

## S4 method for signature 'TariffLogitCournotModels'
initialize(.Object, ...)

## S4 method for signature 'TariffCournot'
initialize(.Object, ...)

Arguments

.Object

an instance of class TariffBertrand or TariffCournot

...

arguments to pass to initialize


Tariff Simulation With A Differentiated-Product Logit Cournot Game

Description

Simulate the effect of tariffs when firms play a differentiated-product Cournot quantity game and demand is Logit.

Usage

logit_cournot_tariff(
  prices,
  quantities,
  shares,
  margins,
  owner = NULL,
  diversions,
  mktElast = NA_real_,
  calibration = c("auto", "diversion", "alm"),
  tariffPre,
  tariffPost,
  weights,
  normIndex,
  subset,
  insideSize,
  priceOutside = 0,
  priceStart,
  isMax = FALSE,
  parmsStart,
  control.slopes,
  control.equ,
  labels,
  output = TRUE,
  ...
)

Arguments

prices

A length k vector of product prices.

quantities

A length k vector of product quantities. Used to calculate shares when shares is missing and to set insideSize when insideSize is missing.

shares

A length k vector of product quantity shares. If missing, shares are calculated as quantities / sum(quantities).

margins

A length k vector of product margins. All margins must be positive or NA.

owner

Required. EITHER a vector of length k whose values indicate which firm produced a product before the tariff OR a k x k matrix of pre-tariff ownership shares.

diversions

A k x k matrix of diversion ratios with diagonal elements equal to -1. Used for the LogitCournot calibration.

mktElast

A negative number equal to the industry pre-tariff price elasticity. Used for the LogitCournotALM calibration.

calibration

Which antitrust Logit Cournot calibration to use. "diversion" creates a TariffLogitCournot object. "alm" creates a TariffLogitCournotALM object. "auto" uses "alm" when mktElast is supplied and diversions is missing; otherwise it uses "diversion".

tariffPre

A vector of length k where each element equals the current ad valorem tariff, expressed as a proportion of the consumer price, imposed on each product. Default is 0.

tariffPost

A vector of length k where each element equals the new ad valorem tariff, expressed as a proportion of the consumer price, imposed on each product. Default is 0.

weights

A length k vector of non-negative product weights used in minimum-distance calibration.

normIndex

An integer specifying the product index against which the mean values of all other products are normalized. Use NA when an outside good is included.

subset

A vector of length k where each element equals TRUE if the product indexed by that element should be included in the post-tariff simulation and FALSE if it should be excluded.

insideSize

A positive number equal to total pre-tariff quantities for all products included in the simulation.

priceOutside

Price of the outside good. Default is 0.

priceStart

A length k vector of starting values used to solve for equilibrium prices. Default is prices.

isMax

If TRUE, checks to see whether computed price equilibrium locally maximizes firm profits and returns a warning if not. Default is FALSE.

parmsStart

A length 2 vector whose first element equals an initial guess of the price coefficient and whose second element equals an initial guess of the outside share. Used only for calibration = "alm".

control.slopes

A list of optim control parameters passed to the calibration routine optimizer.

control.equ

A list of BBsolve control parameters passed to the non-linear equation solver.

labels

A k-length vector of labels.

output

A length 1 logical vector equal to TRUE if the simulation is for an output market. Default is TRUE.

...

Additional options to feed to the optimizer used to solve for equilibrium prices.

Details

This function extends logit.cournot and logit.cournot.alm with the same ad valorem tariff treatment used by the other differentiated-product tariff simulations in this package. Ownership is preserved. Product revenue retention 1 - tariff enters each firm's quantity first-order conditions, and effective marginal cost changes proportionally by (tariffPost - tariffPre) / (1 - tariffPost).

Unlike cournot_tariff, which models homogeneous-product Cournot competition with plant-level quantities, this function models differentiated products with Logit demand.

Value

logit_cournot_tariff returns an instance of class TariffLogitCournot or TariffLogitCournotALM, depending on calibration.

Examples

prodNames <- c("BUD","OLD STYLE","MILLER","MILLER-LITE","OTHER-LITE","OTHER-REG")
owner <- c("BUD","OLD STYLE","MILLER","MILLER","OTHER-LITE","OTHER-REG")
price <- c(.0441,.0328,.0409,.0396,.0387,.0497)
quantities <- c(.066,.172,.253,.187,.099,.223) * 100
margins <- c(.3830,.5515,.5421,.5557,.4453,.3769)
tariff <- c(0,0,0,0,.1,.1)

result <- logit_cournot_tariff(prices = price, quantities = quantities,
                               margins = margins, owner = owner,
                               tariffPost = tariff, labels = prodNames)

print(result)
summary(result)
calcDiagnostics(result)

Tariff Simulation With A Monopolistic Competition Pricing Game

Description

Simulate the effect of tariffs when firms play a Monopolistic Competition game and consumer demand is either Logit or CES

Usage

monopolistic_competition_tariff(
  demand = c("logit", "ces"),
  prices,
  quantities,
  margins,
  mktElast = NA_real_,
  mktSize,
  tariffPre = rep(0, length(quantities)),
  tariffPost = rep(0, length(quantities)),
  priceOutside = ifelse(demand == "logit", 0, 1),
  labels = paste("Prod", 1:length(quantities), sep = "")
)

Arguments

demand

A character vector indicating which demand system to use. Currently allows “logit" or “ces" .

prices

A length k vector product prices. Default is missing, in which case demand intercepts are not calibrated.

quantities

A length k vector of product quantities.

margins

A length k vector of product margins. All margins must be either be between 0 and 1, or NA.

mktElast

A negative number no greater than -1 equal to the industry pre-tariff price elasticity. Default is NA .

mktSize

A positive number equal to the industry pre-tariff market size. Market size equals total quantity sold,including sales to the outside good.

tariffPre

A vector of length k where each element equals the current ad valorem tariff (expressed as a proportion of the consumer price) imposed on each product. Default is 0, which assumes no tariff.

tariffPost

A vector of length k where each element equals the new ad valorem tariff (expressed as a proportion of the consumer price) imposed on each product. Default is 0, which assumes no tariff.

priceOutside

price of the outside good. Default 0 for logit and 1 for ces. Not used for aids.

labels

A k-length vector of labels.

Details

Let k denote the number of products produced by all firms. Using price, and quantity, information for all products in each market, as well as margin information for at least one products in each market, monopolistic_competition_tariff is able to recover the slopes and intercepts of a Logit demand system. These parameters are then used to simulate the price effects of an ad valorem tariff under the assumption that the firms are playing a monopolisitcally competitive pricing game

Value

monopolistic_competition_tariff returns an instance of class TariffMonComLogit , depending upon the value of the “demand” argument.

References

Simon P. Anderson, Andre de Palma, Brent Kreider, Tax incidence in differentiated product oligopoly, Journal of Public Economics, Volume 81, Issue 2, 2001, Pages 173-192. Anderson, Simon P., and Andre De Palma. Economic distributions and primitive distributions in monopolistic competition. Centre for Economic Policy Research, 2015.

See Also

bertrand_tariff to simulate the effects of a tariff under a Bertrand pricing game.

Examples

## Calibration and simulation results from a 10% tariff on non-US beers "OTHER-LITE"
## and "OTHER-REG"
## Source: Epstein/Rubenfeld 2004, pg 80

prodNames <- c("BUD","OLD STYLE","MILLER","MILLER-LITE","OTHER-LITE","OTHER-REG")
price    <- c(.0441,.0328,.0409,.0396,.0387,.0497)
quantities   <- c(.066,.172,.253,.187,.099,.223)*100
margins <- c(.3830,.5515,.5421,.5557,.4453,.3769)
tariff <- c(0,0,0,0,.1,.1)

names(price) <-
 names(quantities) <-
 names(margins) <-
 prodNames


result.logit <- monopolistic_competition_tariff(demand = "logit",prices=price,quantities=quantities,
                                margins = margins,
                                 tariffPost = tariff, labels=prodNames)

print(result.logit)           # return predicted price change
summary(result.logit)         # summarize merger simulation

result.ces <- monopolistic_competition_tariff(demand = "ces",prices=price,quantities=quantities,
                                margins = margins,
                                 tariffPost = tariff, labels=prodNames)

print(result.ces)           # return predicted price change
summary(result.ces)         # summarize merger simulation

Methods To Calculate Producer Surplus

Description

Producer Surplus methods for the TariffBertrand and TariffCournot classes

Usage

## S4 method for signature 'TariffBertrand'
calcProducerSurplus(object, preMerger = TRUE)

## S4 method for signature 'TariffLogitCournotModels'
calcProducerSurplus(object, preMerger = TRUE)

## S4 method for signature 'TariffCournot'
calcProducerSurplus(object, preMerger = TRUE)

Arguments

object

an instance of class TariffBertrand or TariffCournot

preMerger

when TRUE, calculates producer surplus under the existing tariff regime. When FALSE, calculates tariffs under the new tariff regime. Default is TRUE.

Value

product-level (or in the case of Cournot, plant-level) producer surplus


S4 classes to model quotas

Description

Extend classes from the antitrust package to accomodate quotas.

Slots

quotaPre

For QuotaCournot, a matrix containing current plant-level (rows) AND product-level (columns) quotas. Default is a matrix of 0s. For all other classes, a vector containing current product-level quotas. Quotas are expressed as a proportion of pre-merger output. Default is a vector of Infs.

quotaPost

a For QuotaCournot, a matrix containing new plant-level (rows) AND product-level (columns) quotas. Default is a matrix of Infs. For all other classes, a vector containing new product-level quotas. quotas are expressed as a proportion of pre-merger output. Default is a vector of Infss.


Respecify a fitted trade model

Description

respecify() is an S4 generic owned by antitrust; this method dispatches on object's class TradeFit. It applies an explicitly registered transition. Trade delegates demand and portable conduct translations to the corresponding antitrust transition infrastructure, then rebuilds the target trade model through specify. The target preserves observed baseline prices and shares; tariff or quota state is retained where compatible, while policy-adjusted costs and equilibrium state are recomputed under the target equations. Target curvature primitives that are not identified by the source must be supplied explicitly. A target bargaining model likewise requires bargpowerPre unless it is retained from a bargaining source fit. Source margins are not used to recalibrate translated demand, and unsupported or incomplete target model paths fail explicitly. This is not a global equivalence claim between different demand systems.

Usage

## S4 method for signature 'TradeFit'
respecify(object, demand = NULL, conduct = NULL, variant = NULL, ...)

Arguments

object

A TradeFit returned by calibrate or specify.

demand

Optional target demand-system name.

conduct

Optional target conduct name.

variant

Optional target model variant.

...

Reserved for future transition-specific options.

Value

A newly constructed TradeFit under the target specification.

See Also

specify, update.TradeFit


Tariff Simulation With User-Supplied Demand Parameters

Description

Simulates the price effects of an ad valorem tariff with user-supplied demand parameters under the assumption that all firms in the market are playing either a differentiated products Bertrand pricing game, 2nd price auction, or bargaining game.

Let k denote the number of products produced by all firms below.

Parameterized paths that have a registered 'specify()' and 'simulate()' implementation use that boundary. Other historical 'sim()' paths continue through the original implementation.

Usage

.sim_legacy(
  prices,
  supply = c("moncom", "bertrand", "auction2nd", "bargaining"),
  demand = c("logit", "ces", "BLP", "LogitBLP", "CournotBLP"),
  demand.param,
  owner,
  tariffPre = rep(0, length(prices)),
  tariffPost = rep(0, length(prices)),
  subset = rep(TRUE, length(prices)),
  insideSize = 1,
  priceOutside,
  priceStart,
  bargpowerPre = rep(0.5, length(prices)),
  bargpowerPost = bargpowerPre,
  labels = paste("Prod", 1:length(prices), sep = ""),
  ...
)

sim(
  prices,
  supply = c("moncom", "bertrand", "auction2nd", "bargaining"),
  demand = c("logit", "ces", "BLP", "LogitBLP", "CournotBLP"),
  demand.param,
  owner,
  tariffPre = rep(0, length(prices)),
  tariffPost = rep(0, length(prices)),
  subset = rep(TRUE, length(prices)),
  insideSize = 1,
  priceOutside,
  priceStart,
  bargpowerPre = rep(0.5, length(prices)),
  bargpowerPost = bargpowerPre,
  labels = paste("Prod", 1:length(prices), sep = ""),
  ...
)

Arguments

prices

A length k vector of product prices.

supply

A character string indicating how firms compete with one another. Valid values are "moncom" (monopolistic competition), "bertrand" (Nash Bertrand), "auction2nd" (2nd score auction), or "bargaining".

demand

A character string indicating the type of demand system to be used in the merger simulation. Supported demand systems are logit (‘Logit’), ces (‘CES’), BLP, LogitBLP, or CournotBLP.

demand.param

See Below.

owner

Required. EITHER a vector of length k whose values indicate which firm produced a product before the tariff OR a k x k matrix of pre-merger ownership shares.

tariffPre

A vector of length k where each element equals the current ad valorem tariff (expressed as a proportion of the consumer price) imposed on each product. Default is 0, which assumes no tariff.

tariffPost

A vector of length k where each element equals the new ad valorem tariff (expressed as a proportion of the consumer price) imposed on each product. Default is 0, which assumes no tariff.

subset

A vector of length k where each element equals TRUE if the product indexed by that element should be included in the post-merger simulation and FALSE if it should be excluded.Default is a length k vector of TRUE.

insideSize

A length 1 vector equal to total units sold if ‘demand’ equals "logit", or total revenues if ‘demand’ equals "ces".

priceOutside

A length 1 vector indicating the price of the outside good. This option only applies to the ‘Logit’ class and its child classes Default for ‘Logit’,‘LogitNests’, and ‘LogitCap’ is 0, and for ‘CES’ and ‘CesNests’ is 1.

priceStart

A length k vector of starting values used to solve for equilibrium price. Default is the ‘prices’ vector for all values of demand except for ‘AIDS’, which is set equal to a vector of 0s.

bargpowerPre

A length k vector of pre-merger bargaining power parameters. Values must be between 0 (sellers have the power) and 1 (buyers the power). Ignored if ‘supply’ not equal to "bargaining".

bargpowerPost

A length k vector of post-merger bargaining power parameters. Values must be between 0 (sellers have the power) and 1 (buyers the power). Default is ‘bargpowerPre’. Ignored if ‘supply’ not equal to "bargaining".

labels

A k-length vector of labels. Default is “Prod#”, where ‘#’ is a number between 1 and the length of ‘prices’.

...

Additional options to feed to the optimizer used to solve for equilibrium prices.

Details

Using user-supplied demand parameters, sim simulates the effects of a merger in a market where firms are playing a differentiated products pricing game.

If ‘demand’ equals ‘Logit’ then ‘demand.param’ must equal a list containing

alpha

The price coefficient.

meanval

A length-k vector of mean valuations ‘meanval’. If none of the values of ‘meanval’ are zero, an outside good is assumed to exist.

If demand equals ‘CES’ then ‘demand.param’ must equal a list containing

gamma

The price coefficient,

alpha

The coefficient on the numeraire good. May instead be calibrated using ‘shareInside’,

meanval

A length-k vector of mean valuations ‘meanval’. If none of the values of ‘meanval’ are zero, an outside good is assumed to exist,

shareInside

The budget share of all products in the market. Default is 1, meaning that all consumer wealth is spent on products in the market. May instead be specified using ‘alpha’.

Value

sim returns an instance of the class specified by the ‘demand’ argument.

Author(s)

Charles Taragin [email protected]

See Also

The S4 class documentation for: Logit and CES,

Examples

## Calibration and simulation results from a merger between Budweiser and
## Old Style. Note that the in the following model there is no outside
## good; BUD's mean value has been normalized to zero.

## Source: Epstein/Rubenfeld 2004, pg 80


prodNames <- c("BUD","OLD STYLE","MILLER","MILLER-LITE","OTHER-LITE","OTHER-REG")
owner <-c("BUD","OLD STYLE","MILLER","MILLER","OTHER-LITE","OTHER-REG")
tariff <- c(0,0,0,0,.1,.1)

price    <- c(.0441,.0328,.0409,.0396,.0387,.0497)

# a list containing price coefficient and mean valuations
demand.param=list(alpha=-48.0457,
                  meanval=c(0,0.4149233,1.1899885,0.8252482,0.1460183,1.4865730)
)

sim.logit <- sim(price,demand="logit",supply="bertrand", demand.param,
                 owner=owner,tariffPost=tariff,labels=prodNames)



print(sim.logit)           # return predicted price change
summary(sim.logit)         # summarize merger simulation

elast(sim.logit,TRUE)      # returns premerger elasticities
elast(sim.logit,FALSE)     # returns postmerger elasticities

diversion(sim.logit,TRUE)  # return premerger diversion ratios
diversion(sim.logit,FALSE) # return postmerger diversion ratios


antitrust::cmcr(sim.logit)            #calculate compensating marginal cost reduction
antitrust::upp(sim.logit)             #calculate Upwards Pricing Pressure Index

CV(sim.logit)                         #calculate representative agent compensating variation

Summary Methods

Description

Summary methods for the TariffBertrand, QuotaBertrand, TariffLogitCournotModels, and TariffCournot classes

Usage

## S4 method for signature 'TariffBertrand'
summary(
  object,
  revenue = FALSE,
  levels = FALSE,
  parameters = FALSE,
  market = FALSE,
  insideOnly = TRUE,
  digits = 2
)

## S4 method for signature 'TariffLogitCournotModels'
summary(
  object,
  revenue = FALSE,
  levels = FALSE,
  parameters = FALSE,
  market = FALSE,
  insideOnly = TRUE,
  digits = 2
)

## S4 method for signature 'QuotaBertrand'
summary(
  object,
  revenue = FALSE,
  levels = FALSE,
  parameters = FALSE,
  market = FALSE,
  insideOnly = TRUE,
  digits = 2
)

## S4 method for signature 'TariffCournot'
summary(
  object,
  market = FALSE,
  revenue = FALSE,
  levels = FALSE,
  parameters = FALSE,
  digits = 2
)

Arguments

object

an instance of class TariffBertrand, QuotaBertrand, TariffLogitCournotModels, or TariffCournot

revenue

When TRUE, returns revenues, when FALSE returns quantitities. Default is FALSE.

levels

When TRUE returns changes in levels rather than percents and quantities rather than shares, when FALSE, returns changes as a parcent and shares rather than quantities. Default is FALSE.

parameters

When TRUE, displays demand and cost parameters. Default is FALSE.

market

When TRUE, displays aggregate information about the effect of a tariff. When FALSE displays product-specific (or in the case of Cournot, plant-specific) effects. Default is FALSE

insideOnly

When TRUE, rescales shares on inside goods to sum to 1. Default is FALSE.

digits

Number of digits to report. Default is 2.

Value

Prints either market or product/plant-level summary and invisibly returns a data frame containing the same information.


Generate a model-consistent synthetic trade market

Description

'synthetic_market()' is the trade-native fake-market entry point. It draws product shares and ownership through [antitrust::fake_market()], then uses trade's selected policy/model implementation to calibrate the baseline. Structural demand parameters can be difficult to choose directly. Observed mode instead begins with shares, ownership, positive physical marginal costs, a proportional reference margin, and policy state; it solves demand scale and equilibrium consumer prices. This is an intuition experiment, not an empirical data-generating process. For tariffs, physical cost 'c' and effective cost 'c/(1-tariffPre)' are distinguished explicitly. Tariff CES Bertrand and monopolistic-competition routes use revenue shares and identify CES curvature from the reference margin after accounting for the reference tariff. Logit and CES Stackelberg routes additionally draw or accept a passive outside share and solve native leader/follower equilibrium. They require a common tariff rate within each firm because tariff reuse stores effective costs 'c/(1-tariffPre)'.

Usage

synthetic_market(
  demand = "logit",
  supply = "bertrand",
  mode = c("observed", "primitives"),
  policy = c("tariff", "quota"),
  n_firms = 3L,
  n_products = 1L,
  dirichlet_alpha = NULL,
  outside_beta = c(2, 8),
  shares = NULL,
  costs = NULL,
  cost_rule = c("common", "uniform"),
  cost_level = 80,
  cost_range = c(50, 100),
  reference_margin = NULL,
  reference_price = 100,
  prices = NULL,
  outside_margin = NULL,
  parameters = NULL,
  tariffPre = NULL,
  quotaPre = NULL,
  seed = NULL,
  passive_outside_share = NULL,
  passive_outside_range = c(0.1, 0.5),
  leadersPre = NULL,
  stackelberg_conduct = "bertrand",
  ...
)

Arguments

demand

Demand-system name, with '"logit"' as the default.

supply

Supply/conduct name, with '"bertrand"' as the default.

mode

Either '"observed"' or '"primitives"'.

policy

Baseline policy family, '"tariff"' or '"quota"'.

n_firms

Number of inside firms; the reference firm is additional.

n_products

Number of products per inside firm. A scalar is recycled across firms; a vector must have length 'n_firms'.

dirichlet_alpha

Positive product-level Dirichlet parameters, one per inside product. If omitted, all shapes equal one.

outside_beta

Positive Beta shape parameters for the reference share.

shares

Optional complete all-product shares summing to one.

costs

Optional complete positive physical marginal-cost vector.

cost_rule

'"common"' or '"uniform"' observed cost design.

cost_level

Positive common cost, default 80.

cost_range

Positive endpoints for heterogeneous uniform costs.

reference_margin

Proportional reference margin '(p_r-c_r)/p_r' in '(0,1)'. Its price is implied by 'p_r=c_r/(1-reference_margin)'.

reference_price

Positive reference price in primitives mode only.

prices

Optional complete prices in primitives mode only.

outside_margin

Retired observed price-first argument.

parameters

Named model-specific primitives in primitives mode.

tariffPre

Optional tariff-only pre-policy vector.

quotaPre

Optional quota-only pre-policy vector.

seed

Optional explicit integer seed.

passive_outside_share

For observed Stackelberg games, a positive passive outside share. 'NULL' draws uniformly from 'passive_outside_range'; supplied 'shares' remain conditional on active products and are scaled by '1-passive_outside_share' for the native game.

passive_outside_range

Endpoints for the passive outside-share draw.

leadersPre

Optional Stackelberg leader firm IDs. By default the largest firm by aggregate active-product share leads when 'n_firms <= 3'; the three largest lead when 'n_firms > 3'. The reference firm is eligible.

stackelberg_conduct

Underlying Stackelberg game, '"bertrand"' or '"cournot"'; default '"bertrand"'.

...

Model arguments forwarded to [specify()] or, for Stackelberg, [coordination::stackelberg()]. Bargaining power 'bargpowerPre' defaults to 0.5 per product and may be overridden.

Details

The active reference product is a real product in the ownership map. The 'n_firms' argument counts inside firms and the reference firm is additional. 'n_products' may be a scalar shared by all inside firms or a vector with one count per firm. For now, a baseline must be either tariff-only or quota-only. Supplying both 'tariffPre' and 'quotaPre' is rejected explicitly because simultaneous pre-policies are not yet implemented by the trade model registry.

Value

A [TradeFit] directly accepted by [simulate()].

Examples

if (requireNamespace("coordination", quietly = TRUE)) {
  fit <- synthetic_market(
    supply = "stackelberg", n_firms = 2,
    shares = c(0.2, 0.3, 0.5), costs = c(60, 70, 80),
    reference_margin = 0.25, passive_outside_share = 0.2,
    tariffPre = c(0, 0.1, 0)
  )
  fit@diagnostics$synthetic$leadersPre
}

Product tariff accounts

Description

Return product-level revenue, cost, producer-profit, and government-revenue accounts for a TariffGameFit.

Usage

tariff_accounts(object, preMerger = FALSE)

Arguments

object

A TariffGameFit.

preMerger

If TRUE, report the stored baseline; otherwise report the current post-policy state.

Details

Inactive products retain their stored price state but have zero monetary accounts. Costs are reported in both effective and physical units so that tariff revenue is not applied twice.

Value

A data frame with product, firm, consumer price, quantity, tariff fraction, gross revenue, net revenue, effective cost, physical cost, effective unit markup, physical unit profit, net-revenue margin, producer profit, and government revenue. Gross revenue is price times quantity; government revenue is the tariff fraction times gross revenue.

See Also

TariffGameFit, tariff_welfare


Tariff welfare accounting

Description

Summarize physical producer surplus, importing-government revenue, and the established antitrust consumer-variation statistic for a TariffGameFit.

Usage

tariff_welfare(object)

Arguments

object

A TariffGameFit with a stored post-policy state.

Details

The producer and government changes are physical accounting transfers and are reported separately from consumer variation. Consumer variation uses the established antitrust convention, in which a positive value is compensation required for a price increase. No nationality is inferred and no CES-specific quasilinear welfare measure is introduced.

Value

A named list containing physical producer-surplus change, importing-government revenue change, their sum, established antitrust consumer variation, and the negative of that variation as monetary consumer change. The list also records the CV sign convention and scopes: all included producers and the importing government.

See Also

TariffGameFit, tariff_accounts


S4 classes to model tariffs

Description

Extend classes from the antitrust package to accomodate tariffs.

Slots

tariffPre

For TariffCournot, a matrix containing current plant-level (rows) AND product-level (columns) tariffs. Default is a matrix of 0s. For all other classes, a vector containg current product-level tariffs. ad valorem taxes are expressed as a proportion of the consumer price. Default is a vector of 0s.

tariffPost

a For TariffCournot, a matrix containing new plant-level (rows) AND product-level (columns) tariffs. Default is a matrix of 0s. For all other classes, a vector containing new product-level tariffs. ad valorem taxes are expressed as a proportion of the consumer price. Default is a vector of 0s.


Additional methods for TariffCournot Class

Description

Producer Surplus methods for the TariffBertrand and TariffCournot classes

Usage

## S4 method for signature 'TariffCournot'
calcSlopes(object)

## S4 method for signature 'TariffCournot'
calcQuantities(object, preMerger = TRUE, market = FALSE)

## S4 method for signature 'TariffCournot'
calcMC(object, preMerger = TRUE)

Arguments

object

an instance of class TariffCournot

preMerger

when TRUE, computes result under the existing tariff regime. When FALSE, calculates tariffs under the new tariff regime. Default is TRUE.

market

when TRUE, computes market-wide results. When FALSE, calculates plant-specific results.

Value

calcSlopes return a TariffCournot object containing estimated slopes. CalcQuantities returns a matrix of equilbrium quantities under either the current or new tariff. calcMC reports physical marginal production cost, without artificial capacity or nonnegativity penalties. Constraints enter the quantity solver.


A fitted tariff reuse wrapper

Description

TariffGameFit preserves a fitted output-market game and records its consumer-price tariff fractions, effective costs, recovered physical costs, ownership, roles, and immutable source fit. Promotion does not recalibrate or solve the baseline. It supports ordinary output Logit/CES fits and standard output Logit second-score auction fits under the explicit tariff contract and the four native coordination classes StackelbergLogit, StackelbergCES, CoreFringeLogit, and CoreFringeCES.

Usage

## S4 method for signature 'TariffGameFit'
simulate(object, tariffPost = NULL,
  quotaPost = NULL, ownerPost = NULL, leadersPost = NULL,
  corePost = NULL, mcDelta = NULL, subset = NULL,
  priceStart = NULL, ...)

## S4 method for signature 'TariffGameFit'
simulate_steps(object, last_result, steps, ...)

## S4 method for signature 'TariffGameFit'
validate_counterfactual(object, counterfactual)

Arguments

object

A TariffGameFit.

tariffPost

A scalar or product vector of finite consumer-price tariff fractions less than one, or a Counterfactual.

quotaPost

Unsupported for this initial tariff wrapper.

ownerPost

A post-policy product-to-firm vector.

leadersPost

Post-policy Stackelberg leader firm IDs. Required for a Stackelberg ownership change.

corePost

Post-policy Core-Fringe core firm IDs. Required for a Core-Fringe ownership change; an empty core is valid.

mcDelta

A scalar, named product vector, or product vector of physical proportional cost changes. If omitted, retain the current physical-cost shock; explicit zero restores original baseline physical costs.

subset

A logical, product-index, or product-label active-product selection.

priceStart

Optional positive post-policy price starting values.

last_result, steps

The last solved wrapper and the next ordered steps for the sequential extension point.

counterfactual

A supported one-step or multi-step Counterfactual.

...

Additional arguments; unsupported lifecycle and policy arguments are rejected.

Details

Baseline and post costs must be finite and strictly positive in this initial percentage-cost adapter. Zero or negative cost states fail explicitly; retain those posterior draw identities when reporting simulation failures. Post-policy effective costs are derived as cPre * (1 + mcDelta) / (1 - tariffPost). Scenarios always start from the original fitted baseline, so repeated simulations do not compound tariff adjustments. Actual ownership and revenue retention are kept separate. Mixed post tariffs are supported except within native second-score bidding portfolios. Baseline retention must be compatible with the fitted source. Sequential Counterfactual paths instead advance each solved market before applying the next step. Physical cost shocks compound, omitted tariffs persist at their current absolute levels, and exits are cumulative. Paths can be resumed using simulate(path, counterfactual(...)). An entrant's physical cost is converted to effective cost exactly once. Tariff precedence is a simultaneous tariff field, the entrant's tariff extra, then the fit's entrant_tariff default. Entry is implemented only for supported ordinary output models, and pre-entry output is zero. Native coordination paths require explicit leader/core roles when ownership changes; native entry, quota policies and re-estimation remain unsupported. calcMC() reports physical costs, while calcMargins(level = TRUE) reports physical net unit profit and calcMargins(level = FALSE) reports a net-revenue Lerner margin.

Value

simulate() returns a CounterfactualPath for multiple steps. A single step returns a new TariffGameFit containing the updated underlying model and explicit tariff/physical-cost state. Accessor methods return values for that stored game.

See Also

as_trade_fit, tariff_accounts, tariff_welfare


Additional methods for TariffMonComLogit, TariffMonComCES Classes

Description

calcSlopes, Prices, Margins methods for the TariffMonComLogit and TariffMonComCES classes

Usage

## S4 method for signature 'TariffMonComLogit'
calcSlopes(object)

## S4 method for signature 'TariffMonComCES'
calcSlopes(object)

## S4 method for signature 'TariffMonComLogit'
calcMargins(object, preMerger = TRUE, level = FALSE)

## S4 method for signature 'TariffMonComCES'
calcMargins(object, preMerger = TRUE, level = FALSE)

## S4 method for signature 'TariffMonComLogit'
calcPrices(object, preMerger = TRUE, ...)

## S4 method for signature 'TariffMonComCES'
calcPrices(object, preMerger = TRUE, ...)

Arguments

object

an instance of class TariffMonComLogit or class TariffMonComCES

preMerger

when TRUE, computes result under the existing tariff regime. When FALSE, calculates tariffs under the new tariff regime. Default is TRUE.

level

when TRUE, computes margins in dollars. When FALSE, calculates margins as a proportion of prices. Default is FALSE.

...

harmlessly pass the arguments used in other calcPrices methods to methods for TariffMonComLogit and TariffMonComCES.

Value

calcSlopes return a TariffMonComLogit or TariffMonComCES object containing estimated slopes. CalcQuantities returns a matrix of equilbrium quantities under either the current or new tariff.


Calibrate, specify, and simulate trade models

Description

The trade architecture separates construction of a baseline structural model from policy counterfactual simulation. Existing trade S4 objects remain the economic implementation and are returned by simulate. simulate() and respecify() are S4 generics owned by antitrust; trade supplies methods for its own TradeFit class. Trade also supplies the corresponding validate_counterfactual() method so shared path resumption uses trade's model capabilities. Resuming a multi-step CounterfactualPath produced by a TradeFit is handled by antitrust's own shared CounterfactualPath method, which dispatches the new steps back to trade through simulate_steps().

Usage

calibrate(demand, conduct = NULL, variant = "standard",
  policy = "tariff", ...)

specify(demand, conduct = NULL, prices, parameters,
  variant = "standard", policy = "tariff", ...)

## S4 method for signature 'TradeFit'
simulate(object, tariffPost, quotaPost, subset,
  priceStart, bargpowerPost, isMax = FALSE, ...)

## S4 method for signature 'TradeFit'
simulate_steps(object, last_result, steps, ...)

## S4 method for signature 'TradeFit'
validate_counterfactual(object, counterfactual)

Arguments

demand

A demand-system name or a normalized model specification.

conduct

A conduct name when demand is not a specification.

variant

An implemented model variant, such as "standard" or "alm".

policy

The baseline policy family, currently "tariff" or "quota".

prices

A vector of observed product prices.

parameters

A named list of supplied structural parameters.

object

A TradeFit returned by calibrate or specify.

tariffPost

A post-policy ad valorem tariff vector.

quotaPost

A post-policy quota vector.

subset

A logical vector selecting products in the post-policy market.

priceStart

Optional post-policy price starting values.

bargpowerPost

Optional post-policy bargaining-power vector for bargaining models.

isMax

Whether to request the legacy local-maximum check where supported.

last_result

The legacy trade S4 result the path last landed on.

steps

The ordered CounterfactualStep objects to solve next.

counterfactual

A Counterfactual to validate against the fitted trade model's registered capabilities.

...

Baseline inputs, scenario inputs, or solver options accepted by the selected legacy implementation.

Details

calibrate delegates observed-data calibration to a complete registered trade constructor. specify loads supplied structural parameters through the legacy parameterized path where available. simulate clones the fitted object, applies one policy scenario, and invokes the existing model-specific equilibrium methods. A fitted object can be simulated repeatedly.

Value

calibrate and specify return a TradeFit. simulate returns the existing trade S4 result class selected by the fitted model, or a CounterfactualPath for a multi-step Counterfactual. simulate_steps returns a list with one element, results: a list of legacy trade S4 results, one per step, in order. validate_counterfactual returns the validated counterfactual invisibly or raises an error for unsupported fields.

TradeFit class

A TradeFit contains the normalized model specification, the existing calibrated S4 model object, structural parameters, observed inputs, and calibration diagnostics.

See Also

model_spec, supportedModels


Trade model specifications and supported-model registry

Description

Normalize trade demand, conduct, variant, and policy names and inspect the complete economic model combinations implemented by trade.

Usage

model_spec(demand, conduct, variant = "standard", policy = "tariff")

supportedModels()

Arguments

demand

A demand-system name, such as "logit" or "ces".

conduct

A conduct name, such as "bertrand" or "cournot".

variant

An implemented model variant. The standard variant is "standard"; "alm" is used by the ALM Logit-Cournot path.

policy

The policy state represented by the legacy model. Supported values currently include "tariff" and "quota".

Details

The registry describes complete implemented economic models. It does not mechanically combine arbitrary demand and conduct modules. Its entries point to the legacy trade constructors whose calibration and equilibrium equations remain authoritative.

Value

model_spec returns a small normalized specification containing demand, conduct, variant, policy, and id. supportedModels returns a data frame describing the complete registered models, including a promote capability and a promotion_handler for baseline policy state. Promotion additionally requires an exact matching model specification in the antitrust registry.


Recalibrate a fitted trade model

Description

update reruns the complete target trade-model calibration using the stored baseline call. Post-policy arguments remain simulation-only. Fits created only by specify do not contain an observed-data calibration call.

Usage

## S3 method for class 'TradeFit'
update(object, ..., evaluate = TRUE)

Arguments

object

A TradeFit returned by calibrate.

...

Baseline data, model-specification arguments, or model-specific calibration options to replace.

evaluate

If FALSE, return the reconstructed calibration call.

Value

A newly calibrated TradeFit, or a call when evaluate is FALSE.

See Also

calibrate, respecify