Calibrates consumer demand using either a linear or loglinear demand system and then simulates the prices effect of a merger between two firms under the assumption that all firms in the market are playing a differentiated products Bertrand game.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  linear(prices,quantities,margins,
diversions,
symmetry=TRUE,
ownerPre,ownerPost,
mcDelta=rep(0,length(prices)),
subset=rep(TRUE, length(prices)),
priceStart=prices,
labels=paste("Prod",1:length(prices),sep=""),
...
)
loglinear(prices,quantities,margins,
diversions,
ownerPre,ownerPost,
mcDelta=rep(0,length(prices)),
subset=rep(TRUE, length(prices)),
priceStart=prices,
labels=paste("Prod",1:length(prices),sep=""),
...
)


Let k denote the number of products produced by all firms. 
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 either be between 0 and 1, or 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 quantity share is assumed. 
symmetry 
If TRUE, requires the matrix of demand slope coefficients to be symmetric and homogeneous of degree 0 in prices, both of which suffice to make demand consistent with utility maximization theory. Default is TRUE. 
ownerPre 
EITHER a vector of length k whose values indicate which firm produced a product premerger OR a k x k matrix of premerger ownership shares. 
ownerPost 
EITHER a vector of length k whose values indicate which firm produced a product after the merger OR a k x k matrix of postmerger ownership shares. 
mcDelta 
A length k vector where each element equals the proportional change in a product's marginal costs due to the merger. Default is 0, which assumes that the merger does not affect any products' marginal cost. 
subset 
A vector of length k where each element equals TRUE if the product indexed by that element should be included in the postmerger simulation and FALSE if it should be excluded.Default is a length k vector of TRUE. 
priceStart 
A length k vector of prices used as the initial guess in the nonlinear equation solver. Default is ‘prices’. 
labels 
A klength vector of labels. Default is "Prod#", where ‘#’ is a number between 1 and the length of ‘prices’. 
... 
Additional options to feed to the solver. See below. 
Using price, quantity, and diversion information for all products
in a market, as well as margin information for (at least) all the
products of any firm, linear
is able to
recover the slopes and intercepts in a Linear demand
system and then uses these demand parameters to simulate the price
effects of a merger between
two firms under the assumption that the firms are playing a
differentiated Bertrand pricing game.
loglinear
uses the same information as linear
to uncover the
slopes and intercepts in a LogLinear demand system, and then uses these
demand parameters to simulate the price effects of a merger of two firms under the
assumption that the firms are playing a
differentiated Bertrand pricing game.
‘diversion’ must be a square matrix whose offdiagonal elements [i,j] estimate the diversion ratio from product i to product j (i.e. the estimated fraction of i's sales that go to j due to a small increase in i's price). Offdiagonal elements are restricted to be nonnegative (products are assumed to be substitutes), diagonal elements must equal 1, and rows must sum to 0 (negative if you wish to include an outside good) . If ‘diversion’ is missing, then diversion according to quantity share is assumed.
‘ownerPre’ and ‘ownerPost’ values will typically be equal to either 0 (element [i,j] is not commonly owned) or 1 (element [i,j] is commonly owned), though these matrices may take on any value between 0 and 1 to account for partial ownership.
Under linear demand, an analytic solution to the Bertrand pricing game
exists. However, this solution can at times produce negative
equilibrium quantities. To accommodate this issue, linear
uses constrOptim
to
find equilibrium prices with nonnegative quantities. ...
may
be used to change the default options for constrOptim.
loglinear
uses the nonlinear equation solver
BBsolve
to find equilibrium prices. ...
may
be used to change the default options for BBsolve
.
linear
returns an instance of class Linear
.
loglinear
returns an instance of LogLin
, a
child class of Linear
.
Charles Taragin charles.taragin@usdoj.gov
von Haefen, Roger (2002). “A Complete Characterization Of The Linear, LogLinear, And SemiLog Incomplete Demand System Models.” Journal of Agricultural and Resource Economics, 27(02). http://ideas.repec.org/a/ags/jlaare/31118.html.
aids
for a demand system based on revenue shares rather than quantities.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54  ## Simulate a merger between two singleproduct firms in a
## threefirm market with linear demand with diversions
## that are proportional to shares.
## This example assumes that the merger is between
## the first two firms
n < 3 #number of firms in market
price < c(2.9,3.4,2.2)
quantity < c(650,998,1801)
margin < c(.435,.417,.370)
#simulate merger between firms 1 and 2
owner.pre < diag(n)
owner.post < owner.pre
owner.post[1,2] < owner.post[2,1] < 1
result.linear < linear(price,quantity,margin,ownerPre=owner.pre,ownerPost=owner.post)
print(result.linear) # return predicted price change
summary(result.linear) # summarize merger simulation
elast(result.linear,TRUE) # returns premerger elasticities
elast(result.linear,FALSE) # returns postmerger elasticities
diversion(result.linear,TRUE) # returns premerger diversion ratios
diversion(result.linear,FALSE) # returns postmeger diversion ratios
cmcr(result.linear) # returns the compensating marginal cost reduction
CV(result.linear) # returns representative agent compensating variation
## Implement the Hypothetical Monopolist Test
## for products 1 and 2 using a 5% SSNIP
#HypoMonTest(result.linear,prodIndex=1:2)
## Get a detailed description of the 'Linear' class slots
showClass("Linear")
## Show all methods attached to the 'Linear' Class
showMethods(classes="Linear")
## Show which class have their own 'elast' method
showMethods("elast")
## Show the method definition for 'elast' and Class 'Linear'
getMethod("elast","Linear")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.