Skip to main content

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 from terminal

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"],
    "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.make_cicb_for_ts(99, draws = 1000, hyp = 'twosided')
model.plot_stats()

Find optimal exclusion level and plot counterfactuals

model.find_optimal_u()
model.plot_counterfactuals()

Inspect 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

  • _hat_v : estimate of quantile function of value residuals

  • _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

  • _hat_rev : auctioneer revenue as function of exclusion level u

  • q_ci, v_ci, _bs_ci, _ts_ci, _rev_ci : simulated confidence intervals

  • q_cb, v_cb, _bs_cb, _ts_cb, _rev_cb : simulated confidence bands

  • q_ci_asy, v_ci_asy, _bs_ci_asy, _rev_ci_asy : asymptotic (theoretical) confidence intervals

Metadata

Release files for simple-fpa 1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-fpa 1.8
File Size Uploaded
simple_fpa-1.8.tar.gz 1.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-fpa 1.8
File Interpreter ABI Platform
simple_fpa-1.8-py3-none-any.whl Python 3 none any Details

Total release size: 3.2 MB

Release files / simple_fpa-1.8.tar.gz

Download URL simple_fpa-1.8.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
145a1c6a284b18de153d6d6c5cc9c97eb54f4b31238591410e9fa085282f9069
BLAKE2b-256 checksum
How to use checksums
fe6d36ec1a5ad0419c27244905ae818d5b271ddff95b52276372767ea44099d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.2

Release files / simple_fpa-1.8-py3-none-any.whl

Download URL simple_fpa-1.8-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a310f8ab5bf61b86759e29a6ad51e3863a612e45f7a85a55c7030950c29ed3a6
BLAKE2b-256 checksum
How to use checksums
141029a479eadf02ce937c67187d3982c45daaab5e8f4adcc2f80300268e6e6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.2

Release history Release notifications | RSS feed

This release

1.8 This release

2 release files

1.7

2 release files

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1.1

2 release files

1.1

2 release files

1.0

2 release files

0.9

2 release files

0.8

2 release files

0.7

2 release files

0.6

2 release files

0.5

2 release files

0.3

2 release files

0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page