Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,7 @@ jobs:
shell: bash -l {0}
run: |
pip install --upgrade "jax[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
pip install --upgrade "numpyro[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
nvidia-smi
- name: Install latex dependencies
shell: bash -l {0}
run: |
apt-get -qq update
export DEBIAN_FRONTEND=noninteractive
apt-get install -y tzdata
apt-get install -y \
texlive-latex-recommended \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-xetex \
latexmk \
xindy
- name: Display Conda Environment Versions
shell: bash -l {0}
run: conda list
Expand Down
63 changes: 8 additions & 55 deletions lectures/two_auctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ jupytext:
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.10.3
kernelspec:
display_name: Python 3 (ipykernel)
display_name: Python 3
language: python
name: python3
---
Expand All @@ -29,32 +27,22 @@ We'll also learn about and apply a

* Revenue Equivalent Theorem


We recommend watching this video about second price auctions by Anders Munk-Nielsen:

```{youtube} qwWk_Bqtue8
```


and


```{youtube} eYTGQCGpmXI
```

Anders Munk-Nielsen put his code [on GitHub](https://github.com/GamEconCph/Lectures-2021/tree/main/Bayesian%20Games).

Much of our Python code below is based on his.




+++

## First-Price Sealed-Bid Auction (FPSB)

+++

**Protocols:**

* A single good is auctioned.
Expand Down Expand Up @@ -110,16 +98,10 @@ $$
y_{i} = \max_{j \neq i} v_{j}
$$ (eq:optbid2)



A proof for this assertion is available at the [Wikepedia page](https://en.wikipedia.org/wiki/Vickrey_auction) about Vickrey auctions

+++

## Second-Price Sealed-Bid Auction (SPSB)

+++

**Protocols:** In a second-price sealed-bid (SPSB) auction, the winner pays the second-highest bid.

## Characterization of SPSB Auction
Expand All @@ -128,15 +110,10 @@ In a SPSB auction bidders optimally choose to bid their values.

Formally, a dominant strategy profile in a SPSB auction with a single, indivisible item has each bidder bidding its value.

A proof is provided at [the Wikepedia
page](https://en.wikipedia.org/wiki/Vickrey_auction) about Vickrey auctions

+++
A proof is provided at [the Wikepedia page](https://en.wikipedia.org/wiki/Vickrey_auction) about Vickrey auctions

## Uniform Distribution of Private Values

+++

We assume valuation $v_{i}$ of bidder $i$ is distributed $v_{i} \stackrel{\text{i.i.d.}}{\sim} U(0,1)$.

Under this assumption, we can analytically compute probability distributions of prices bid in both FPSB and SPSB.
Expand All @@ -147,12 +124,8 @@ We can use our simulation to illustrate a **Revenue Equivalence Theorem** th

To read about the revenue equivalence theorem, see [this Wikepedia page](https://en.wikipedia.org/wiki/Revenue_equivalence)

+++

## Setup

+++

There are $n$ bidders.

Each bidder knows that there are $n-1$ other bidders.
Expand All @@ -173,7 +146,7 @@ $$

and the PDF of $y_i$ is $\tilde{f}_{n-1}(y) = (n-1)y^{n-2}$.

Then bidder $i$'s optimal bid in a **FPSB** auction is:
Then bidder $i$'s optimal bid in a **FPSB** auction is:

$$
\begin{aligned}
Expand All @@ -188,8 +161,6 @@ $$

In a **SPSB**, it is optimal for bidder $i$ to bid $v_i$.

+++

## Python Code

```{code-cell} ipython3
Expand All @@ -202,7 +173,7 @@ import scipy.interpolate as interp

# for plots
plt.rcParams.update({"text.usetex": True, 'font.size': 14})
colors = plt. rcParams['axes.prop_cycle'].by_key()['color']
colors = plt.rcParams['axes.prop_cycle'].by_key()['color']

# ensure the notebook generate the same randomess
np.random.seed(1337)
Expand All @@ -220,11 +191,11 @@ v = np.random.uniform(0,1,(N,R))

# BNE in first-price sealed bid

b_star = lambda vi,N :((N-1)/N) * vi
b_star = lambda vi,N: ((N-1)/N) * vi
b = b_star(v,N)
```

We compute and sort bid price distributions that emerge under both FPSB and SPSB.
We compute and sort bid price distributions that emerge under both FPSB and SPSB.

```{code-cell} ipython3
idx = np.argsort(v, axis=0) # Biders' values are sorted in ascending order in each auction.
Expand Down Expand Up @@ -271,12 +242,8 @@ sns.despine()

## Revenue Equivalence Theorem

+++

We now compare FPSB and a SPSB auctions from the point of view of the revenues that a seller can expect to acquire.



**Expected Revenue FPSB:**

The winner with valuation $y$ pays $\frac{n-1}{n}*y$, where n is the number of bidders.
Expand Down Expand Up @@ -305,8 +272,6 @@ $$
\end{aligned}
$$

+++

Thus, while probability distributions of winning bids typically differ across the two types of auction, we deduce that expected payments are identical in FPSB and SPSB.

```{code-cell} ipython3
Expand All @@ -325,7 +290,7 @@ ax.set_ylabel('Density')
sns.despine()
```

**<center>Summary of FPSB and SPSB results with uniform distribution on $[0,1]$</center>**
**Summary of FPSB and SPSB results with uniform distribution on $[0,1]$**

| Auction: Sealed-Bid | First-Price | Second-Price |
| :-----------------------: | :----------------------------------: | :-------------------------------------: |
Expand All @@ -336,8 +301,6 @@ sns.despine()
| Bayesian Nash equilibrium | Bidder $i$ bids $\frac{n-1}{n}v_{i}$ | Bidder $i$ truthfully bids $v_{i}$ |
| Auctioneer's revenue | $\frac {n-1}{n+1}$ | $\frac {n-1}{n+1}$ |

+++

**Detour: Computing a Bayesian Nash Equibrium for FPSB**

The Revenue Equivalence Theorem lets us an optimal bidding strategy for a FPSB auction from outcomes of a SPSB auction.
Expand All @@ -354,12 +317,8 @@ $$

It follows that an optimal bidding strategy in a FPSB auction is $b(v_{i}) = \mathbf{E}_{y_{i}}[y_{i} | y_{i} < v_{i}]$.

+++

## Calculation of Bid Price in FPSB

+++

In equations {eq}`eq:optbid1` and {eq}`eq:optbid1`, we displayed formulas for
optimal bids in a symmetric Bayesian Nash Equilibrium of a FPSB auction.

Expand All @@ -371,10 +330,8 @@ where
- $v_{i} = $ value of bidder $i$
- $y_{i} = $: maximum value of all bidders except $i$, i.e., $y_{i} = \max_{j \neq i} v_{j}$


Above, we computed an optimal bid price in a FPSB auction analytically for a case in which private values are uniformly distributed.


For most probability distributions of private values, analytical solutions aren't easy to compute.

Instead, we can compute bid prices in FPSB auctions numerically as functions of the distribution of private values.
Expand Down Expand Up @@ -519,9 +476,7 @@ ax.set_ylabel('Density')
sns.despine()
```

## 5 Code Summary

+++
## Code Summary

We assemble the functions that we have used into a Python class

Expand Down Expand Up @@ -646,8 +601,6 @@ chi_squ_case.plot_winner_payment_distribution()

## References

+++

1. Wikipedia for FPSB: https://en.wikipedia.org/wiki/First-price_sealed-bid_auction
2. Wikipedia for SPSB: https://en.wikipedia.org/wiki/Vickrey_auction
3. Chandra Chekuri's lecture note for algorithmic game theory: http://chekuri.cs.illinois.edu/teaching/spring2008/Lectures/scribed/Notes20.pdf
Expand Down