Title: | Estimate First-Price Auction Model |
---|---|
Description: | Estimates a first-price auction model with conditionally independent private values as described in MacKay (2020) <doi:10.2139/ssrn.3096534>. The model allows for unobserved heterogeneity that is common to all bidders in addition to observable heterogeneity. |
Authors: | Alex MacKay [aut, cre], Bob Freeman [aut], Paul Jonak [aut], Victoria Prince [aut], Ista Zahn [aut] |
Maintainer: | Alex MacKay <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2025-02-20 04:16:14 UTC |
Source: | https://github.com/ajmack/auctionr |
auction_model
Generates sample data for running auction_model
auction_generate_data( obs = NULL, max_n_bids = 10, new_x_mean = NULL, new_x_sd = NULL, mu = NULL, alpha = NULL, sigma = NULL, beta = NULL )
auction_generate_data( obs = NULL, max_n_bids = 10, new_x_mean = NULL, new_x_sd = NULL, mu = NULL, alpha = NULL, sigma = NULL, beta = NULL )
obs |
Number of observations (or auctions) to draw. |
max_n_bids |
Maximum number of bids per auction (must be 3 or greater). The routine generates a vector of length |
new_x_mean |
Mean values for observable controls to be generated from a Normal distribution. |
new_x_sd |
Standard deviations for observable controls to be generated from a Normal distribution. |
mu |
Value for mu, or mean, of private value distribution (Weibull) to be generated. |
alpha |
Value for alpha, or shape parameter, of private value distribution (Weibull) to be generated. |
sigma |
Value for standard deviation of unobserved heterogeneity distribution. Note that the distribution is assumed to have mean 1. |
beta |
Coefficients for the generated observable controls. Must be of the same length as |
This function generates example data for feeding into auction_model(). Specifically, the winning bid, number of bids, and observed heterogeneity are sampled for the specified number of observations.
A data frame with obs
rows and the following columns:
winning_bid |
numeric values of the winning bids for each observation |
n_bids |
number of bids for each observation |
X# |
X terms that represent observed heterogeneity |
dat <- auction_generate_data(obs = 100, mu = 10, new_x_mean= c(-1,1), new_x_sd = c(0.5,0.8), alpha = 2, sigma = 0.2, beta = c(-1,1)) dim(dat) head(dat)
dat <- auction_generate_data(obs = 100, mu = 10, new_x_mean= c(-1,1), new_x_sd = c(0.5,0.8), alpha = 2, sigma = 0.2, beta = c(-1,1)) dim(dat) head(dat)
Estimates a first-price auction model.
auction_model( dat = NULL, init_param = NULL, num_cores = 1, method = "BFGS", control = list(), std_err = FALSE, hessian_args = list() )
auction_model( dat = NULL, init_param = NULL, num_cores = 1, method = "BFGS", control = list(), std_err = FALSE, hessian_args = list() )
dat |
A data.frame containing input columns in the following order: the winning bids, number of bids, and |
init_param |
Vector of initial values for mu, alpha, sigma, and beta vector, provided in order specified.
Note that the Weibull distribution requires mu and alpha to be positive. The standard deviation of unobserved heterogeneity, sigma, must be positive as well. The Beta vector may take any values.
If |
num_cores |
The number of cores for running the model in parallel. The default value is 1. |
method |
Optimization method to be used in optim() (see ?optim for details). |
control |
A list of control parameters to be passed to optim() (see ?optim for details). |
std_err |
If TRUE, the standard errors of the parameters will also be calculated. Note that it may significantly increase the computation time. |
hessian_args |
A list of arguments passed as the |
This function estimates a first-price auction model with conditionally independent private values. This version of the package estimates a procurement auction, where the winning bid is the amount that a single buyer will pay to the top bidding supplier, and values correspond to costs. The model allows for unobserved heterogeneity that is common to all bidders in addition to observable heterogeneity. The winning bid (Y) takes the form
Y = B * U * h(X)
where B is the proportional winning bid, U is the unobserved heterogeneity, and h(X) controls for observed heterogeneity. The model is log-linear so that log(Y) = log(B) + log(U) + log(h(X)) and log(h(X)) = beta1 * X1 + beta2 * X2 + ...
The (conditionally) independent private costs are drawn from a Weibull distribution with parameters mu (mean) and alpha (shape). The CDF of this distribution is given by
F(c) = 1 - exp(- (c * 1/mu * Gamma(1 + 1/alpha))^(alpha))
The unobserved heterogeneity U is sampled from log-normal distribution with mean 1 and a free parameter sigma representing its standard deviation.
init_params
, the initial guess for convergence, must be supplied.
This function utilizes the Rsnow
framework within the Rparallel
package. If numcores
is not specified, this will be run using only
one CPU/core. One can use parallel::detectCores()
to determine how many are available on your system, but you are not advised
to use all at once, as this may make your system unresponsive. Please see Rparallel
and Rsnow
for more details.
Note that the supplied data can not have missing values.
A list returned by optim()
. See ?optim
for more details. If std_err
was set to TRUE and the routine succeeded in inverting
the estimated Hessian, the list will have an additional component:
std_err |
A vector of standard errors for parameter estimates. |
Mackay, Alexander. [email protected], HBS Research Computing [email protected].
Mackay, Alexander. 2020. "Contract Duration and the Costs of Market Transactions." Working paper, Appendix G.
########################################################################### ## Estimating parameters and standard errors with custom "control" argument set.seed(100) dat <- auction_generate_data(obs = 15, mu = 10, alpha = 2, sigma = 0.2, beta = c(-1,1), new_x_mean= c(-1,1), new_x_sd = c(0.5,0.8)) res <- auction_model(dat, init_param = c(8, 2, .5, .4, .6), num_cores = 1, control = list(parscale = c(1,0.1,0.1,1,1)), std_err = TRUE) res ## run vignette("auctionr") to view a more detailed example
########################################################################### ## Estimating parameters and standard errors with custom "control" argument set.seed(100) dat <- auction_generate_data(obs = 15, mu = 10, alpha = 2, sigma = 0.2, beta = c(-1,1), new_x_mean= c(-1,1), new_x_sd = c(0.5,0.8)) res <- auction_model(dat, init_param = c(8, 2, .5, .4, .6), num_cores = 1, control = list(parscale = c(1,0.1,0.1,1,1)), std_err = TRUE) res ## run vignette("auctionr") to view a more detailed example
Print an auction model.
## S3 method for class 'auctionmodel' print(x, digits = 6, ...)
## S3 method for class 'auctionmodel' print(x, digits = 6, ...)
x |
An object of class auctionmodel. |
digits |
Number of digits to display. |
... |
Additional arguments passed to other methods. |
x, invisibly.