Skip to content

[two_auctions] Fix conditional expectation simulation#652

Merged
mmcky merged 2 commits intomainfrom
fix-two_auctions
Oct 22, 2025
Merged

[two_auctions] Fix conditional expectation simulation#652
mmcky merged 2 commits intomainfrom
fix-two_auctions

Conversation

@oyamad
Copy link
Member

@oyamad oyamad commented Oct 21, 2025

Before

image

Looking at such a figure which exhibits a systematic discrepancy, one should suspect that there should be a bug somewhere.

The values in the array v in this line

bid_simulated = [evaluate_largest(ii, v) for ii in v_grid]
have already been sorted. One has to redraw random valuations to pass to evaluate_largest.

After

image

@github-actions
Copy link

📖 Netlify Preview Ready!

Preview URL: https://pr-652--sunny-cactus-210e3e.netlify.app (8a7206b)

📚 Changed Lecture Pages: two_auctions

@mmcky mmcky requested a review from Copilot October 22, 2025 03:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in the conditional expectation simulation for the two auctions lecture. The issue was that the simulation was using pre-sorted valuations instead of fresh random draws, causing a systematic discrepancy between analytical and simulated results.

Key Changes:

  • Added code to redraw random valuations before computing simulated bids
  • Removed outdated comments about discrepancy that no longer apply after the fix
  • The fix ensures evaluate_largest receives unsorted random values as intended

@mmcky
Copy link
Contributor

mmcky commented Oct 22, 2025

thank you @oyamad

@mmcky mmcky requested a review from HumphreyYang October 22, 2025 03:50
@mmcky
Copy link
Contributor

mmcky commented Oct 22, 2025

@HumphreyYang this looks good. I will merge this later today if you want to have a quick look.

@HumphreyYang
Copy link
Member

HumphreyYang commented Oct 22, 2025

Many thanks @oyamad and @mmcky. It looks great to me! I just pushed a minor edit to add some spaces that is unrelated to @oyamad's edit.

Please feel free to merge it and make it live (as well as the Morris lecture).

@github-actions
Copy link

📖 Netlify Preview Ready!

Preview URL: https://pr-652--sunny-cactus-210e3e.netlify.app (644e9d3)

📚 Changed Lecture Pages: two_auctions

@mmcky mmcky merged commit 6e967af into main Oct 22, 2025
1 check passed
@mmcky mmcky deleted the fix-two_auctions branch October 22, 2025 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants