I'm using R's Package Antitrust
for calculating demand own and cross price elasticities and printing the summary results of a merger between firms. The model used is PC-AIDS (Proportionally Calibrated Almost Ideal Demand System), published by Epstein and Rubinfeld (2007). It is a brand-level simulation and companies are allowed owning more than one brand in the standard simulation, as I've seen in excel. My wish is to print the results adequately, in a merger between two firms and one of them owning more than one brand (pre-merger).
My problem, though, seems to be a problem of programming/understanding the output of the code. I'll post a similar code of what I have done:
require(antitrust)
ownerPre<-c("a","a","b","c")
ownerPost<-c("a","a","a","c")
shares<-c(0.30,0.20,0.20,0.30)
knownelast<- -1.5
mktelast <- -1.0
results<-pcaids(shares,knownelast, mktelast, ownerPre=ownerPre,ownerPost=ownerPost,
labels=ownerPre,knownElastIndex=1)
resume<-summary(results)
resume
And after the line of results<-summary(results)
, I get the following error in my output window:
Error in `row.names<-.data.frame`(`*tmp*`, value = value) :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique value when setting 'row.names': ‘* a’
summary(results)
holds results of price variation, output variation etc.
Maybe Antitrust
is not pre-programed similarly to other versions I've seen of PC-AIDS and maybe I cannot obtain such results from this package -- making the exercise of writing this question almost pointless. But if this is by any chance a programming issue, in which someone more experienced in R might help, I invite a helpful answer.
There is an issue printing data.frame objects when the row name is the same:
mat <- matrix(1:10, ncol=2)
mat
[,1] [,2]
[1,] 1 6
[2,] 2 7
[3,] 3 8
[4,] 4 9
[5,] 5 10
rownames(mat) <- rep("a", 5)
mat
[,1] [,2]
a 1 6
a 2 7
a 3 8
a 4 9
a 5 10
Now let's make it a data.frame:
temp <- as.data.frame(mat)
temp
Error in data.frame(V1 = c("1", "2", "3", "4", "5"), V2 = c(" 6", " 7", : duplicate row.names: a
The solution for your problem is to rename the labels so that each is distinct:
ownerPreLab <- c("a.1","a.2","b","c")
results <- pcaids(shares, knownelast, mktelast, ownerPre=ownerPre, ownerPost=ownerPost,
labels=ownerPreLab, knownElastIndex=1)
resume<-summary(results)
Merger simulation results under 'PCAIDS' demand:
priceDelta sharesPre sharesPost outputDelta
* a.1 44 30 29 -2.4
* a.2 44 20 20 -2.4
* b 81 20 16 -18.4
c 11 30 35 16.4
Notes: '*' indicates merging parties' products. Deltas are percent changes.
Output is based on revenues.
Share-Weighted Price Change: 38.55
Share-Weighted CMCR: 37.58