Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how can I generate an auction dataset that has some variation in the number of bidders?

    Hi All,

    I would like to generate an auction dataset that has some variation in the number of bidders across auctions. For example, in the following example, we have 9 auctions, and maybe in auction 1 we have 7 bidders, auction 2 we have 5 bidders. Also, in each auction, the bids are drawn from a uniform distribution.
    I know how to generate a balanced one(each auction has the same bidders) but an unbalanced one. Any help would be appreciated ! Thanks
    auction_id bidder1 bidder2 bidder3 bidder4 bidder5 bidder6 bidder7 bidder8 bidder9
    1
    2
    3
    4
    5
    6
    7
    8
    9

  • #2
    If want to use the wide format (perhaps not the best choice), you can leave some bidder values missing.

    Code:
    clear
    set obs 10
    local maxbidder = 15
    gen int auction_id = _n
    gen int nbidder = ceil(`maxbidder' * runiform()) // one possibility
    forval i = 1/`maxbidder' {
       // for example
       gen bidder`i' = rnormal(10,2) if (`i' <= nbidder)
    }
    Or, you might do better with the long format:
    Code:
    clear
    set obs 10
    gen int auction_id = _n
    local maxbidder = 15
    gen int nbidder = ceil(`maxbidder' * runiform()) // one possibility
    expand nbidder
    bysort auction_id: gen int bidder = _n
    // for example
    gen bidder = rnormal(10,2)

    Comment


    • #3
      Hi Mike,

      Thank you so much. That exactly what I am looking for. I really appreciate it.

      All best,
      Li

      Comment

      Working...
      X