| 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 |
These functions are implemented in antitrust and re-exported by trade because they are useful for inspecting calibrated tariff and quota simulations.
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, ...)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, ...)
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()'. |
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.
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", ...)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", ...)
object |
A fitted |
policy |
The registered trade policy family, currently |
... |
The baseline policy state. Tariff models accept |
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.
A TradeFit containing the copied source model and policy state.
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@pricePresource_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
Simulate the effect of tariffs when firms play a second score procurement auction game and consumer demand is Logit.
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 = ""), ... )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 = ""), ... )
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 |
control.equ |
A list of |
labels |
A k-length vector of labels. |
... |
Additional options to feed to the |
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.
auction2nd_tariff returns an instance of class Tariff2ndLogit
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.
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.
## 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## 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
Simulate the effect of tariffs when firms play a Nash Bargaining game and consumer demand is Logit or CES.
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 = ""), ... )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 = ""), ... )
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 |
control.equ |
A list of |
labels |
A k-length vector of labels. |
... |
Additional options to feed to the |
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 ; the
ownership matrices continue to represent the firms' actual ownership shares.
bargaining_tariff returns an instance of class TariffBargainingLogit or TariffBargainingCES
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.
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.
Simulate the effect of quotas when firms play a Bertrand pricing game and consumer demand is Logit.
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 = ""), ... )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 = ""), ... )
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 |
control.equ |
A list of |
labels |
A k-length vector of labels. |
... |
Additional options to feed to the |
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.
bertrand_quota returns an instance of class QuotaLogit.
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.
## 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## 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
Simulate the effect of tariffs when firms play a Bertrand pricing game and consumer demand is either Logit, CES, or AIDS
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 = ""), ... )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 = ""), ... )
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 |
|
control.slopes |
A list of |
control.equ |
A list of |
labels |
A k-length vector of labels. |
... |
Additional options to feed to the |
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.
bertrand_tariff returns an instance of class TariffLogit, TariffCES, or TariffAIDS, depending upon the value of the “demand” argument.
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.
monopolistic_competition_tariff to simulate the effects of a tariff under monopolistic competition.
## 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## 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_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.
combine_counterfactuals(...)combine_counterfactuals(...)
... |
'Counterfactual' objects, each with exactly one step. |
A one-step 'Counterfactual'.
'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.
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, ... )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, ... )
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. |
A 'Counterfactual' object with exactly one 'CounterfactualStep'.
Simulate the effect of tariffs when firms play a cournot quantity setting game and consumer demand is either linear or log-linear
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, ... )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, ... )
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 |
control.equ |
A list of |
labels |
A k-length vector of labels. |
... |
Additional options to feed to the |
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 gives plant a seller
retention of on product . Baseline physical
marginal cost is calibrated as . At an
equilibrium, a producing plant's marginal revenue in its quantity-setting
first-order condition is ,
where is the ownership share. Outputs satisfy non-negativity
and the supplied plant capacity constraints.
cournot_tariff returns an instance of Cournot-class from package antitrust, depending upon the value of the “demand” argument.
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.
## 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)## 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)
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.
## S4 method for signature 'TariffBertrand' HypoMonTest(object, prodIndex, ssnip = 0.05, ...) ## S4 method for signature 'TariffCournot' HypoMonTest(object, plantIndex, prodIndex, ssnip = 0.05, ...)## S4 method for signature 'TariffBertrand' HypoMonTest(object, prodIndex, ssnip = 0.05, ...) ## S4 method for signature 'TariffCournot' HypoMonTest(object, plantIndex, prodIndex, ssnip = 0.05, ...)
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). |
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.
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.
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 for the TariffBertrand and TariffCournot classes
## 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, ...)## 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, ...)
.Object |
an instance of class |
... |
arguments to pass to initialize |
Simulate the effect of tariffs when firms play a differentiated-product Cournot quantity game and demand is Logit.
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, ... )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, ... )
prices |
A length k vector of product prices. |
quantities |
A length k vector of product quantities. Used to calculate
shares when |
shares |
A length k vector of product quantity shares. If missing,
shares are calculated as |
margins |
A length k vector of product margins. All margins must be
positive or |
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 |
mktElast |
A negative number equal to the industry pre-tariff price
elasticity. Used for the |
calibration |
Which antitrust Logit Cournot calibration to use.
|
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 |
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 |
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 |
control.slopes |
A list of |
control.equ |
A list of |
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. |
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.
logit_cournot_tariff returns an instance of class
TariffLogitCournot or
TariffLogitCournotALM, depending on
calibration.
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)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)
Simulate the effect of tariffs when firms play a Monopolistic Competition game and consumer demand is either Logit or CES
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 = "") )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 = "") )
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. |
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
monopolistic_competition_tariff returns an instance of class TariffMonComLogit , depending upon the value of the “demand” argument.
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.
bertrand_tariff to simulate the effects of a tariff under a Bertrand pricing game.
## 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## 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
Producer Surplus methods for the TariffBertrand and TariffCournot classes
## 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)## 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)
object |
an instance of class |
preMerger |
when TRUE, calculates producer surplus under the existing tariff regime. When FALSE, calculates tariffs under the new tariff regime. Default is TRUE. |
product-level (or in the case of Cournot, plant-level) producer surplus
Extend classes from the antitrust package to accomodate quotas.
quotaPreFor 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.
quotaPosta 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() 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.
## S4 method for signature 'TradeFit' respecify(object, demand = NULL, conduct = NULL, variant = NULL, ...)## S4 method for signature 'TradeFit' respecify(object, demand = NULL, conduct = NULL, variant = NULL, ...)
object |
A |
demand |
Optional target demand-system name. |
conduct |
Optional target conduct name. |
variant |
Optional target model variant. |
... |
Reserved for future transition-specific options. |
A newly constructed TradeFit under the target specification.
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.
.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 = ""), ... ).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 = ""), ... )
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. |
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
The price coefficient.
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
The price coefficient,
The coefficient on the numeraire good. May instead be calibrated using ‘shareInside’,
A length-k vector of mean valuations ‘meanval’. If none of the values of ‘meanval’ are zero, an outside good is assumed to exist,
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’.
sim returns an instance of the class specified by the
‘demand’ argument.
Charles Taragin [email protected]
The S4 class documentation for: Logit and
CES,
## 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## 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 for the TariffBertrand, QuotaBertrand, TariffLogitCournotModels, and TariffCournot classes
## 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 )## 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 )
object |
an instance of class |
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. |
Prints either market or product/plant-level summary and invisibly returns a data frame containing the same information.
'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)'.
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", ... )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", ... )
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. |
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.
A [TradeFit] directly accepted by [simulate()].
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 }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 }
Return product-level revenue, cost, producer-profit, and government-revenue
accounts for a TariffGameFit.
tariff_accounts(object, preMerger = FALSE)tariff_accounts(object, preMerger = FALSE)
object |
A |
preMerger |
If |
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.
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.
Summarize physical producer surplus, importing-government revenue, and the
established antitrust consumer-variation statistic for a TariffGameFit.
tariff_welfare(object)tariff_welfare(object)
object |
A |
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.
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.
TariffGameFit, tariff_accounts
Extend classes from the antitrust package to accomodate tariffs.
tariffPreFor 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.
tariffPosta 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.
Producer Surplus methods for the TariffBertrand and TariffCournot classes
## 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)## 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)
object |
an instance of class |
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. |
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.
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.
## 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)## 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)
object |
A |
tariffPost |
A scalar or product vector of finite consumer-price tariff
fractions less than one, or a |
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 |
... |
Additional arguments; unsupported lifecycle and policy arguments are rejected. |
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.
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.
as_trade_fit, tariff_accounts,
tariff_welfare
calcSlopes, Prices, Margins methods for the TariffMonComLogit and TariffMonComCES classes
## 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, ...)## 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, ...)
object |
an instance of class |
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 |
calcSlopes return a TariffMonComLogit or TariffMonComCES object containing estimated slopes. CalcQuantities returns
a matrix of equilbrium quantities under either the current or new tariff.
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().
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)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)
demand |
A demand-system name or a normalized model specification. |
conduct |
A conduct name when |
variant |
An implemented model variant, such as |
policy |
The baseline policy family, currently |
prices |
A vector of observed product prices. |
parameters |
A named list of supplied structural parameters. |
object |
A |
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 |
counterfactual |
A |
... |
Baseline inputs, scenario inputs, or solver options accepted by the selected legacy implementation. |
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.
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.
A TradeFit contains the normalized model specification, the existing
calibrated S4 model object, structural parameters, observed inputs, and
calibration diagnostics.
Normalize trade demand, conduct, variant, and policy names and inspect the complete economic model combinations implemented by trade.
model_spec(demand, conduct, variant = "standard", policy = "tariff") supportedModels()model_spec(demand, conduct, variant = "standard", policy = "tariff") supportedModels()
demand |
A demand-system name, such as |
conduct |
A conduct name, such as |
variant |
An implemented model variant. The standard variant is
|
policy |
The policy state represented by the legacy model. Supported
values currently include |
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.
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.
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.
## S3 method for class 'TradeFit' update(object, ..., evaluate = TRUE)## S3 method for class 'TradeFit' update(object, ..., evaluate = TRUE)
object |
A |
... |
Baseline data, model-specification arguments, or model-specific calibration options to replace. |
evaluate |
If |
A newly calibrated TradeFit, or a call when evaluate is
FALSE.