2011-1st Price Auction-CV

This is a Common Value Auction Experimental written by yinung for powebe.

#=============================================================================
# 1st Price CV Auction for 6 persons by yinung
# 2011.03.31: 解決 G_AVG() 在人數不足時的實際人數計算
#  
#=============================================================================
M TimeToStart = 2011-04-01 00:17:30
M InitialSteps=0
M TimeSpan = 25
M ENDTIME = 15
M TERMINATE = if(SimStep>=10,1,0)
M NumberFormat = "#,##0.##"

M ROLEASSIGN = "random"
M showidentity=0

# 分組指令: 6 人一組
G person = {"bidder1", "bidder2", "bidder3", "bidder4", "bidder5", "bidder6"}
V upper = 11
V lower = 0

V pv = int(randbetween(lower,upper))
V myPV = previous(pv,0)

D bid={0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10}
  ##### D bid={0,1,2,3,4,5,6,7,8,9,10}
V mybid=bid
P mybid.label="出價"

# 用小數點的 decimal 用來決定整數位相同時, 誰得標
V decimal = randbetween(0,0.09)
V bid0=bid+decimal

####使用 G_Maxt來抓群組中之最大值
v max_bid=G_max("bid0")
v max_bid_original=G_max("bid")
  P max_bid_original.label="最高價"

####
V initial_cash_balance = 10

#### 該回合的 common value (CV)計算, 有兩種方式:
#    採 (1) 將 2 個人的 private signal 平均. 
   ### V cv=G_AVG("myPV")
   # 利用 flag 找有出價的人
   V flag=if(bid>0,1,0)
   # 計算人數 NOB
   V NOB=G_SUM("flag")   
   V cv = G_SUM("myPV")/NOB
   ## ----> V cv=G_AVG("myPV")

v payoff= if(SimStep<1,0,if(bid0=max_bid,initial_cash_balance + (cv-bid),0))
  P payoff.label="報酬"

v acc_payoff=ACCUM(payoff,0)
P acc_payoff.label="累計報酬"


T table 1={"cv","myPV","mybid","max_bid_original","payoff","acc_payoff"}
#T table 2={"flag","NOB","cv","myPV","mybid","max_bid_original","payoff","acc_payoff"}
         #T table 1={"pv","myPV","mybid","bid0","max_bid","payoff","acc_payoff"}
M TextInformation = "1st-p-auc.htm"

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: