This file contains the required information for the replication of the results in:
Author: Samuel Häfner, Web3 Foundation, Zug, and University of St. Gallen, samuel.haefner@gmail.com.
Current version: October, 2022.
The auction data is contained in the file setofbids.csv
. Each row corresponds to a submitted price-quantity pair. The columns are the following:
Variable | Description |
---|---|
auction |
auction id |
quotatot |
quota (in kg) |
bid_id |
bid id |
bidder |
bidder id |
qb |
quantity point (not cumulative, in kg) |
pb |
price point (in Swiss cents) |
qr |
resulting quantity (from that price-quantity pair) |
pr |
resulting payment |
qperc |
percentage of total quota |
This repository contains the following items:
Auxiliary.jl
- Reads in the required packages, the data set and defines the required auxiliary functions and global variables.Grouping.jl
- Determines the bidder groups and auction groups used for the estimation.Estimation.jl
- Contains the main functions for the estimation of W, , and the bounds.TestMon.jl
- Contains the main functions to test for the monotonicity of in v.EstimateWandTSLURM.jl
- Produces the required .jl and .sh files to compute and save estimates of W and .EstimateWandTRobustSLURM.jl
- Produces the required files to compute and save the robustness checks for , using a log-normal distribution rather than a gamma distribution when estimating W.EstimateBoundsSLURM.jl
- Produces the required files to compute standard and tighter bounds, using the estimates of W(p,q) obtained with EstimateWandTSLURM.jl.TestMonSLURM.jl
- Produces the required files to test for monotonicity of F.EstimateWandTGeneric.jl
EstimateWandTRobustGeneric.jl
EstimateBoundsGeneric.jl
TestMonGeneric.jl
EstimateWandTGeneric.sh
EstimateWandTRobustGeneric.sh
EstimateBoundsGeneric.sh
TestMonGeneric.sh
ReadEstimates.jl
- Scripts and functions to read in the estimates of the bounds and produce the respective tables.ReadT.jl
- Scripts to read in estimates of T and produce the plots and tables.ReadTRobust.jl
- Same as above, but using the alternative estimates (robustness check).ReadTestMon.jl
- Contains the script to read in the monotonicity violations obtained and saved with TestMonGeneric.jl and produces the respective tables.DataOverviewTable.jl
- Script to generate the overview table of the data (Table 1).Plots.jl
- Script to generate the group plots, the resampling plots, and the plot showing the estimated bounds (which is done with function PlotTighterBounds()
; cf. the file for more information).Comment 1: The script TestMonWandBounds.jl
produces the required files containing the estimates of W(p,q) and the bounds for the monotonicity check. This script needs to be run before the TestMon*.jl scripts, using the bash script TestMonWandBounds.sh
.
Comment 2: Computation was conducted at sciCORE (scientific computing core) facility at the University of Basel, using a SLURM workload manager. The Julia version used was 1.6. Computation time depended on the script, ranging from 2-3 hours (WandTGeneric.jl and TestMonGeneric.jl) up to 24 hours (EstimateBoundsGeneric.jl).
The estimation was conducted at sciCORE (scientific computing core) facility at the University of Basel, using a SLURM workload manager. This allows to run several bootstrap rounds in parallel.
Below, I describe the basic procedure to do so. (Further down, in the Example section, I explain how the programs can be run locally.)
TestMonWandBounds.sh
and TestMonWandBounds.jl
to the relevant folder and run the following main .sh files: (1) EstimateWandT.sh
, (2) EstimateWandTRobust.sh
, (3) EstimateBounds.sh
, (4) TestMonWandBounds.sh
, (5) TestMon.sh
. Scripts (1) and (2) can be run in parallel, but they need to be completed before running (3). Script (4) needs to be run before script (5) (see Comment 1 above).Comment 3: The estimates that I obtained and reported in the manuscript (Estimate Data.zip
) can be downloaded here. This file contains the .dat files, so that the interested reader may directly jump to Point 5 above.
The following code, which can be run locally, goes through the basic computations. Doing one bootstrap round, the code first estimates W(p,q), then computes , and last determines the bounds for and .
#######################################################################
## load the data set.
## define global variables and relevant functions
##
## required packages: CSV; DataFrames; Distributions;
## BSON: @save, @load; Roots
#######################################################################
include("Auxiliary.jl")
include("Estimation.jl")
include("Grouping.jl")
include("TestMon.jl")
#######################################################################
## the following lines compute the estimates of W(p,q).
#######################################################################
# obtain the average number of active bidders for each bidder group
n = AvgNoBidders(bidderassignment)
# do m=1 bootstrap round
m = 1
# draw P=200 opponent demand functions when resampling (cf. Algorithm 1)
P = 200
# W is computed for each auction group separately
W = []
for i in [1:1:length(group);]
auctionset = group[i]
prices = PriceBids(auctionset)
push!(W, Wgamma(prices, auctionset, bidderassignment, n, m, P))
end
######################################################################
## The following computes all the values required
## to compute $\Theta_g(\rho)$ for the values in rhovec.
##
## The result is a list of the following form:
## Theta[auctiongroup][auction][rhovalue][totalpairs=1,violations=2],
## the entries of which consists of three numbers, one corresponding
## to each bidder group.
######################################################################
# define the vector of rho values for with \Theta_g is computed
rhovec = [[exp(x),exp(x),exp(x)] for x in sort!(append!([-10:0.5:0;],-Inf))]
# the values are computed for each auction
# in each auction group [g] separately
Theta = []
for g in [1:1:length(group);]
auctionset = group[g]
prices = PriceBids(auctionset)
ThetaGroup = []
for auction in auctionset
ThetaAuction = []
for i in [1:1:length(rhovec);]
bounds = EstimateSimpleBounds(
auction,
W[g],
bidderassignment,
prices,
rhovec[i],
m,
)
push!(
ThetaAuction,
EstTheta(
auction,
W[g],
bidderassignment,
prices,
bounds,
rhovec[i][1],
m,
),
)
end
push!(ThetaGroup, ThetaAuction)
end
push!(Theta, ThetaGroup)
end
########################################################################
## The following code computes both the simple and the tighter bounds
## for rho=(0,0,0) and rho=rho^* (only the first for rho=0, and
## both for rho=rho*) for all active bidders in a given auction
##
## The result is a list called BoundAuctions,
## BoundsAuction[1] -- List of length=77, each element corresponding to
## the simple bounds under risk neutrality of
## an active bidder
## BoundsAuction[2] -- List of length=2. The first element is a list as above
## but under risk aversion, \rho^*.
## The second element is a list containing the
## tighter bounds for each bidder under \rho^*.
########################################################################
# define the two vectors of values for rho within the three groups
rhovec = [[0,0,0],[exp(-5),exp(-7),exp(-8)]]
# take the third auction in the first auction group, g=2
g = 2
prices = PriceBids(group[g])
auction = group[g][3]
BoundsAuction = []
for i in [1:1:length(rhovec);]
simplebounds = EstimateSimpleBoundsRobust(
auction,
W[g],
bidderassignment,
prices,
rhovec[i],
m,
)
if i == 1
push!(BoundsAuction, simplebounds)
else
push!(
BoundsAuction,
EstTighterBounds(
auction,
W[g],
bidderassignment,
prices,
simplebounds,
rhovec[i],
m,
10,
0.0001,
),
)
end
end
The following table explains which scripts are used to produce the tables and plots in the main paper.
Figure/Table | Script | Comment |
---|---|---|
Figure 1 | none | tikz-scripts in separate .tex files (available upon request) |
Figure 2 | none | tikz-script in separate .tex file (available upon request) |
Figure 3 | Plots.jl |
Lines 9-34 (left panel). Lines 63-83 (right panel). |
Figure 4 | ReadT.jl |
Lines 1-95; 190-340. |
Figure 5 | Plots.jl |
Function PlotTighterBounds() ; see the file for further information. |
Figure 6 | Plots.jl |
Lines 36-60 (left panel). Lines 63-85 (right panel). |
Figure 7 | Plots.jl |
Lines 154-180 (left panel). Lines 88-151 (right panel). |
Figure 8 | Plots.jl |
Lines 282-618. |
Table 1 | DataOverviewTable.jl |
See file for more information. |
Table 2 | ReadT.jl |
Lines 342-361. |
Table 3 | ReadEstimates.jl |
See file for more information. |
Table 4 | ReadTestMon.jl |
See file for more information. |
Table 5 | ReadEstimates.jl |
See file for more information. |
The following table explains which scripts are used to produce the tables and plots in the supplementary appendix of the paper.
Figure/Table | Script | Line Number |
---|---|---|
Figure 1 | ReadT.jl |
Lines 1-95; 364-789. |
Figure 2 | ReatT.jl (right figure) and ReadTRobust.jl (left figure) |
See files for more information. |
Table 1 | ReadT.jl |
Lines 1-95; 364-789. |
Table 2 | ReatT.jl (right table) and ReadTRobust.jl (left table) |
See files for more information. |
Tables in Section D | ReadEstimates.jl |
See files for more information. |
This section provides the details about the functions and global variables defined in the four main files.
The main global variables used throughout the replication files are defined in the file Auxiliary.jl
and are the followoing.
Variable | Description |
---|---|
bids |
a data frame containing the bidding data |
K |
max number of price-quantity pairs |
un |
unit of account (100 corresponds to CHF/kg) |
vupperbar |
upper bound on type space (in CHF) |
auctionindeces |
vector containing the auctionindeces corresponding to those in the data |
bidderindeces |
vector containing the bidderindeces corresponding to those in the data |
quotas |
vector with the quotas |
clearingprices |
vector with the market clearing prices |
activebidders |
vector with the number of active bidders |
activebidderindeces |
list of vectors with the indeces of the active bidders |
In the file Grouping.jl
the following, additional global variables used for the estimation of W are defined:
Variable | Description |
---|---|
group |
list containing, for each auction group, a vector of the respective auction indeces |
bidderassignment |
a vector determining for every bidder the bidder group assignment {1,2,3} |
In the following subsections, I discuss the functions defined in the respective files Estimation.jl
, TestMon.jl
, and Auxiliary.jl
.
Wgamma(prices, auctionset, bidderassignment, n, m, P)
Estimates using a gamma distribution.
prices
-- vector of submitted prices to be used for the estimation of .
auctionset
-- vector with indeces of auctions to be used for the estimation of .
bidderassignment
-- bidder assignment vector
n
-- vector, each entry corresponding to the (average) number of active bidders from a given group
m
-- number of bootstrap rounds to be estimated
P
-- number of rounds of resampling used for estimation
A list of parameter estimates for the distribution of . For each group in bidderassignment
, each bootstrap round, and each price in the vector prices
.
Wlnorm(prices, auctionset, bidderassignment, n, m, P)
Same as Wgamma()
, yet using a log normal distribution.
SimpleBound(bid, WPar, rho, Q)
Computes upper and lower bounds on the rationalizable profit functions as described in Proposition 3 and equations (9)-(10).
bid
-- bid function
WPar
-- array, containing the estimated parameters of W(p,q) at (p_i^j) for steps j=1,...,k
rho
-- positive real number, corresponding to the risk preference
Q
-- positive real number, corresponding to the quota
A list of dataframes, [vlb,vub], where vub is the data frame containing the upper bound and vlb is the data frame containing lower bound.
SimpleBoundRobust(bid, WPar, rho, Q)
Computes upper and lower bounds on the rationalizable profit
functions as described in Proposition 3.
If the bounds violated the inequalities (15) in Proposition 4,
return upper bound = vupperbar
and lower bound = bid
.
bid
-- bid function
WPar
-- array, containing the estimated parameters of at for steps j=1,...,k
rho
-- positive real number, corresponding to the risk preference
Q
-- positive real number, corresponding to the quota
Return a list of dataframes, [vlb,vub], where vub is the data frame containing the upper bound and vlb is the data frame containing lower bound.
EstimateSimpleBounds(auction, W, bidderassignment, prices, rhovec, m)
Computes SimpleBounds()
for all bidders in auction
.
auction
-- auction index
W
-- estimate of , as returned from Wgamma()
or Wlnorm()
bidderassignment
-- bidder assignment vector
prices
-- vector of submitted prices used for the estimation of
rhovec
-- vector of positive real number, each number corresponding to the risk preference in bidder group
m
-- number of bootstrap rounds to be estimated
A list of objects returned by SimpleBounds()
, one entry per bidder.
EstimateSimpleBoundsRobust(auction, W, bidderassignment, prices, rhovec, m)
Computes SimpleBoundsRobust()
for all bidders in auction
.
auction
-- auction index
W
-- estimate of , as returned from Wgamma()
or Wlnorm()
bidderassignment
-- bidder assignment vector
prices
-- vector of submitted prices used for the estimation of
rhovec
-- vector of positive real number, each number corresponding to the risk preference in bidder group
m
-- number of bootstrap rounds to be estimated
A list of objects returned by SimpleBoundRobust()
, one entry per bidder.
EstTheta(auction, W, bidderassignment, prices, bounds, rho, m)
Determines violations of the inequalities in Proposition 4 for a given auction.
auction
-- auction index
W
-- estimate of W, as returned from Wgamma()
or Wlnorm()
bidderassignment
-- bidder assignment vector
prices
-- vector of prices used for the estimation of W
bounds
-- estimated simple bounds from EstimateSimpleBounds()
rho
-- positive real number, the risk preference
m
-- number of bootstrap rounds
A list of three matrices, with the columns corresponding to bootstrap rounds and rows corresponding to bidder groups. The first matrix counts the number of violations of the inequalities (15) in Prop. 4, the second matrix counts the number of violations of the inequalities (16) in Prop. 4, and the third matrix counts the total number of submitted price-quantity pairs.
TighterBounds(bid, initvl, initvu, W, g, prices, rho, Q, bootstraprun, maxiter, tolerance)
Computes tighter upper and lower bounds from initial conditions initvl
and initivu
by runing Algorithm 2.
bid
-- bid function
initvl
-- marginal profit function, the initial condition for the lower bound
initvu
-- marginal profit function, the initial condition for the upper bound
W
-- estimate of W, as returned from Wgamma()
or Wlnorm()
g
-- natural number, indicating the group number of the auction
prices
-- vector of prices used for the estimation of W
rho
-- positive real number, the risk preference
bootstraprun
-- index of boostratp run we look at
maxiter
-- maximum number of fixed point iterations
tolerance
-- tolerance level (used in iteration)
A list of dataframes, [vlb,vub], where vub is the data frame containing the upper bound and vlb is the data frame containing lower bound.
EstTighterBounds(auction, W, bidderassignment, prices, bounds, rhovec, m, maxiter, tolerance)
Runs TighterBounds()
for all bidders in an auction
and for m
bootstrap rounds.
auction
-- auction index
W
-- estimate of W, as returned from Wgamma()
or Wlnorm()
bidderassignment
-- bidder assignment vector
prices
-- vector of prices used for the estimation of W
bounds
-- estimated simple bounds from EstimateSimpleBoundsRobust()
rhovec
-- vector of positive real number, each number corresponding to the risk preference in bidder group
m
-- number of boostratp runs
maxiter
-- maximum number of fixed point iterations
tolerance
-- tolerance level (used in iteration)
List containing for each bidder and each bootstrap round a two dimensional list [bounds
,tighterbounds
], where tighterbounds
is the object returned by TighterBounds()
.
TestIncreasingDiff(auction, bidderset, BoundsAuction, W, R, rhoindexset, rhovec)
Determines the number of price-quantity pairs for which the monotonicity assumption on is violated for a given auction.
auction
-- auction index
bidderset
-- bidder index set (set of bidders to be looked at)
BoundsAuction
-- first element in list returned by LoadWandBounds()
W
-- second element in list returned by LoadWandBounds()
R
-- number of tests per bid step
rhoindexset
-- vector of indexes, referring to rhovec, for which the test is run
rhovec
-- vector of rho values
A list of length of the rhoindexset
, each entry is again a list of length of the bidderset
, and each entry of that list consists of two numbers: (1) the total number of price-quantity pairs tested for that bidder (2) the total number of price-quantity pairs for which a violation of monotonicity was found.
GetQVals(g, bidstep)
Draws a random number (uniformly between 1 and 20) of equidistant x-values that lie between the x-values of the bidstep
-th price-quantity pair and the (bidstep
-1)-th price-quantity pair in g
.
g
-- decreasing step function function with a number of steps of at least bidstep
bidstep
-- natural number, indicating the number of the step in the bid function
List of x-values.
GetHigherF(g, h, qval)
Compute a random step function between g
and h
with x values given in qval
g
, h
-- decreasing step function, satisfying g
> h
qvals
-- x-values returned by GetQVals()
Data frame containing the step function, [vval,qval].
CheckFOCMonotone(bidstep, bid, vub, vlb, W, g, prices, rho, Q, bootstraprun, R)
Evaluates at the two different, ordered profit functions R
times and reports the differences.
bidstep
-- natural number, the bid step to be looked at
bid
-- bid function
vub
-- marginal profit function, (simple) upper bound
vlb
-- marginal profit function, (simple) lower bound
W
-- estimate of W as obtained by Wgamma()
or Wlnorm()
g
-- natural number, indicating the group number of the auction
prices
-- vector of prices used for the estimation of W
rho
-- real number, risk preference
Q
-- real number, the quota
bootstraprun
-- the number of the bootrap round
R
-- the number of tests per bid step
List of length R
, containing the differences.
LoadWandBounds(auction)
Loads estimates of W and of simple bounds for auction
from corresponding .dat files.
auction
-- auction index
List containing W and simple bounds for auction
TestIncreasingDiffBidder(auction, bidder, Bounds, W, R, rho)
Determines for a bidder in a given auction whether monotonicity of is violated for the submitted price-quantity pairs.
auction
-- auction index
bidder
-- bidder index
Bounds
-- first element in list returned by LoadWandBounds(
)
W
-- second element in list returned by LoadWandBounds()
R
-- number of tests per bid step
rho
-- real number, risk preference
Two-dimensional list, [number of tests performed (corresponds to the number of bid steps), number of violations]
qpBid(bidder, auction)
Retrieve the bid function of a bidder in an auction.
bidder
-- bidderindex
auction
-- auctionindex
A data frame: [qb (quantity points), pb (price points), cumqb (cumulated quantity points)].
AvgNoBidders(bidderassignment)
Determine the average number of bidders in each bidder cluster
bidderassignment
-- vector, each element corresponding to a bidder, denoting the cluster number of the respective bidder
A list of real numbers; one for each cluster number; returning the average no. of bidders.
BidToCover(auction)
Determines the bid-to-cover ratio in an auction.
auction
-- auctionindex
Real number; corresponding to the bid-to-cover ratio.
Revenue(auction)
Determines the revenue from an auction.
auction
-- auctionindex
Real number; corresponding to the auction revenue.
qRec(bidder, auction)
Determines the allocated quantity of a bidder in a given auction.
bidder
-- bidderindex
auction
-- auctionindex
Real number; corresponding to the allocated quantity.
qShareRec(bidder, auction)
Determines the share of quota that is allocated to a bidder in a given auction.
bidder
-- bidderindex
auction
-- auctionindex
Real number; corresponding to the received share.
ActiveAuctions(bidder)
Determines the indeces of the auctions in which a bidder is active.
bidder
-- bidderindex
A list of integers; corresponding to the indices of the auctions in which the bidder was active.
AvgBid(bidder)
Determines the average bid of a bidder across the auctions in which that bidder was active.
bidder
-- bidderindex
Real number; corresponding to the average bid of the bidder.
ShareSuccBidders(auction)
Determines the share of succesfull bidders (with non-zero allocated quantity) in an auction.
auction
-- auctionindex
Real number; corresponding to the share of successful bidders.
SuccessRate(bidder)
Returns the success rate of a bidder (succesfull participation/total participation).
bidder
-- bidderindex
Real number; corresponding to the bidder's success rate.
StepBid(q, bid)
Determines the value of (cf. the manuscript for a definition).
q
-- positive real number
bid
-- bid function as returned from qpBid(bidder, auction)
Real number; value of .
NoStepBid(q, bid)
Determines the step of the step function at q
. That is, returns the number of downward jumps that have occured strictly before q
, plus one.
q
positive real number
bid
bid function as returned from qpBid(bidder, auction)
Integer; see description.
StepV(q, v)
Returns the value of the profit function v(q).
q
-- positive real number
v
-- marginal profit function, which is a data frame with columns qval
(quantities, need to be increasing) and vval
(the values of v)
Real number; corresponding to the value of the profit function v(q).
IntBid(a, b, bid)
Returns the value of .
a
, b
-- positive real numbers
bid
-- bid function as returned from qpBid(bidder, auction)
Real number; value of .
IntV(a, b, v)
Returns the value of .
a
, b
-- positive real numbers
v
-- marginal profit function
Real number; value of .
PiOverline(bidstep, bid, v, WPar, rho, Q, n)
Returns the value of (cf. the manuscript for a definition).
bidstep
-- positive natural number, corresponding to the number of the step under consideration,
bid
-- bid function
v
-- marginal profit function
WPar
-- array, containing the estimated parameters of the distribution of for steps
rho
-- positive real number, corresponding to the risk preference
Q
-- positive real number, corresponding to the quota
n
-- positive natural number, indicating the number of support points used for integration
Real number.
w(q, WPar, dp)
Computes .
q
-- positive real number
WPar
-- array, containing two sets of estimated parameters of the distribution of ; one for and one for .
dp
-- positive real number
Real number; value of .
PriceBids(auctionset)
Returns all submitted prices in auctionset
in ascending order.
auctionset
-- vector, containing auction indeces
List of real numbers; prices submitted in the auctions in auctionset
.
FOC(bidstep, bid, v, W, group, prices, rho, Q, bootstraprun, n)
FOC()
returns the value of (cf. the manuscript).
bidstep
-- positive natural number, corresponding to the number of the step under consideration, j
bid
-- bid function
v
-- marginal profit function
W
-- estimates of W as returned from Wgamma()
or Wlnorm()
group
-- natural number, indicating the group number of the auction
prices
-- vector of submitted prices used for the estimation of
rho
-- positive real number, corresponding to the risk preference
Q
-- positive real number, corresponding to the quota
bootstraprun
-- natural number, indicating the boostrap run number
n
-- positive natural number, indicating the number of support points used for integration
Real number; value of .
VarPhiU(q, v, vl)
Determines (cf. the manuscript).
q
-- positive real number
v
-- marginal profit function
vl
-- positive real number, corresponding to
Real number; value of .
VarPhiL(q, v, vu)
Determines (cf. the manuscript).
q
-- positive real number
v
-- marginal profit function
vu
-- positive real number, corresponding to
Real number; value of .