Skip to content
Open
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
18 changes: 9 additions & 9 deletions lectures/two_auctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ plt.rcParams.update({"text.usetex": True, 'font.size': 14})
colors = plt.rcParams['axes.prop_cycle'].by_key()['color']

# ensure the notebook generates the same randomness
np.random.seed(1337)
rng = np.random.default_rng(1337)
```

We repeat an auction with 5 bidders for 100,000 times.
Expand All @@ -212,7 +212,7 @@ The valuations of each bidder is distributed $U(0,1)$.
N = 5
R = 100_000

v = np.random.uniform(0, 1, (N, R))
v = rng.uniform(0, 1, (N, R))

# BNE in first-price sealed bid

Expand Down Expand Up @@ -431,7 +431,7 @@ v_grid = np.linspace(0.3, 1, 8)
bid_analytical = b_star(v_grid, N)

# Redraw valuations
v = np.random.uniform(0, 1, (N, R))
v = rng.uniform(0, 1, (N, R))
bid_simulated = [evaluate_largest(ii, v) for ii in v_grid]

fig, ax = plt.subplots(figsize=(6, 4))
Expand All @@ -453,8 +453,8 @@ Let's try an example in which the distribution of private values is a $\chi^2$ d
We'll start by taking a look at a $\chi^2$ distribution with the help of the following Python code:

```{code-cell} ipython3
np.random.seed(1337)
v = np.random.chisquare(df=2, size=(N * R,))
rng = np.random.default_rng(1337)
v = rng.chisquare(df=2, size=(N * R,))

plt.hist(v, bins=50, edgecolor='w')
plt.xlabel('Values: $v$')
Expand All @@ -464,8 +464,8 @@ plt.show()
Now we'll get Python to construct a bid price function

```{code-cell} ipython3
np.random.seed(1337)
v = np.random.chisquare(df=2, size=(N, R))
rng = np.random.default_rng(1337)
v = rng.chisquare(df=2, size=(N, R))

# we compute the quantile of v as our grid
pct_quantile = np.linspace(0, 100, 101)[1:-1]
Expand Down Expand Up @@ -663,8 +663,8 @@ class bid_price_solution:
```

```{code-cell} ipython3
np.random.seed(1337)
v = np.random.chisquare(df=2, size=(N, R))
rng = np.random.default_rng(1337)
v = rng.chisquare(df=2, size=(N, R))

chi_squ_case = bid_price_solution(v)
```
Expand Down
Loading