Skip to main content

Simple nonparametric inference for sealed first-price auctions.

Project description

A package for the "Nonparametric inference on counterfactuals in sealed first-price auctions" paper by Pasha Andreyanov and Grigory Franguridi.

It contains a class that fits the auction data using a symmetric first-price auction model with either additive or multiplicative heterogeneity, and predicts latent valuations and counterfactuals.

The interface of the package consists of 4 steps.

  • pass a dataframe with auctionid and bid column names
  • pass covariate (continuous and discrete) column names and create bid residuals and fitted values
  • fit the non-parametric model
  • predict latent bids, and also expected total surplus, potential bidder surplus and revenue, as functions of exclusion level

Arxiv and Github repository

https://arxiv.org/abs/2106.13856

https://github.com/pandreyanov/pashas_simple_fpa

Sample code

Package can be installed via pip (exclamation ! means terminal command)

!pip install simple_fpa

Import typical auction data

from simple_fpa import Model
import pandas as pd
import numpy as np

import matplotlib.pyplot as plt
from pylab import rcParams

rcParams.update({
    "text.usetex": True,
    "font.family": "serif",
    "font.serif": ["Arial"],
})

rcParams['figure.dpi'] = 200

df = pd.read_csv('../_data/haile_data_prepared.csv', index_col=0)

Residualize the bids, print summary

model = Model(data = df, auctionid_columns = ['auctionid'], bid_column = 'actual_bid')
cont_covs = ['adv_value', 'hhi', 'volume_total_1']
disc_covs = ['year', 'forest']
model.residualize(cont_covs, disc_covs, 'multiplicative')

model.summary()

# # we can simulate artificial data, of course
# model.data._resid = np.sort(np.random.uniform(0,1,size = len(model.data)))

Trim the residuals, fit the model and predict latent valuations

model.trim_residuals(10)
model.fit(smoothing_rate = 0.2, trim_percent = 5, reflect = True)
model.predict()

Make confidence intervals and confidence bands

model.make_ci(99, hyp = 'twosided')
model.make_cb(99, draws = 1000, hyp = 'twosided')
model.plot_stats()
model.plot_counterfactuals()

Look at the data

model.data.sample(5)

Predictions

The counterfactuals are populated into the original dataset, ordered by the magnitude of bid redisuals. Some observations will not have a prediction, as they will be ignored (trimmed) in the non-parametric estimation. I use underscore in front of all variables created by the package.

  • _resid : bid residuals

  • _fitted : bid fitted values

  • _trimmed : variable takes 1 if observations were omitted (trimmed) and 0 otherwise

  • _u : u-quantile levels, takes values between 0 and 1

  • _hat_q : estimate of quantile density of bid residuals

  • _q_ci : respective asymptotic confidence intervals

  • _q_cb : respective (asy. valid) simulated confidence bands

  • _hat_v : estimate of quantile function of value residuals

  • _v_ci : respective asymptotic confidence intervals

  • _v_cb : respective (asy. valid) simulated confidence bands

  • _latent_resid : same as _hat_v

  • _hat_ts : total surplus as function of exclusion level u

  • _hat_bs : (one) potential bidder surplus as function of exclusion level u

  • _bs_ci : respective asymptotic confidence intervals

  • _bs_cb : respective (asy. valid) simulated confidence bands

  • _hat_rev : auctioneer revenue as function of exclusion level u

  • _rev_ci : respective asymptotic confidence intervals

  • _rev_cb : respective (asy. valid) simulated confidence bands

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_fpa-0.9.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_fpa-0.9-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file simple_fpa-0.9.tar.gz.

File metadata

  • Download URL: simple_fpa-0.9.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.12

File hashes

Hashes for simple_fpa-0.9.tar.gz
Algorithm Hash digest
SHA256 11bd0a0fa9a4fc7857da7404cfbab9138282df2b27c7646dd98b224185714a1d
MD5 fffcaeb3ce496e216e243fbcb5eab5db
BLAKE2b-256 fb8d338e63354e1f77c25b6fb792d5b2a5423be27abe904d9d5483806f2f0f0e

See more details on using hashes here.

File details

Details for the file simple_fpa-0.9-py3-none-any.whl.

File metadata

  • Download URL: simple_fpa-0.9-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.12

File hashes

Hashes for simple_fpa-0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 1df2e3693a90d51302d3d9d2e3ec5fc29249214d2a85d302b39f043359fcddfe
MD5 c9e74b38d7519f38b3084073cf811e2d
BLAKE2b-256 b8b8e0a67961666450e26b46fdb95e04d3244e98bc9d14c66768bf241360b573

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page