《实验经济学》课件ppt第8讲 经济实验实施实例电子商务信誉机制的有效性检验_第1页
《实验经济学》课件ppt第8讲 经济实验实施实例电子商务信誉机制的有效性检验_第2页
《实验经济学》课件ppt第8讲 经济实验实施实例电子商务信誉机制的有效性检验_第3页
《实验经济学》课件ppt第8讲 经济实验实施实例电子商务信誉机制的有效性检验_第4页
《实验经济学》课件ppt第8讲 经济实验实施实例电子商务信誉机制的有效性检验_第5页
已阅读5页,还剩100页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1,实验经济学第八讲: 经济实验实施实例:电子商务信誉机制的有效性检验,财经大学经济学院-经济学实验室,2,作业: Programming with Visual Basic 6.0 Enhanced Edition, Diane Zak, Tutorial 5,Tutorial 6 and Tutorial 10 (三周时间),3,一、背景环境,4,Bolton,Katok and Ockenfels (2004)的研究采用如下博弈来刻画电子商务交易过程: 销售者和购买者手中各有35元。 销售者向购买者出售标价为35元的商品,该商品对购买者而言价值50元。 销售者从供货渠道获得产品、直到将产品运送到购买者手中全部过程所产生的成本为20元。,5,购买者有两种可能的选择:购买或不购买。 如果购买者选择不购买,则销售者和购买者各自保有自己的35元。 如果购买者选择购买,则购买者把自己的35元交付给销售者。,6,销售者在得到购买者的35元之后也有两种选择,发货或不发货。 如果销售者选择不发货,则销售者得到70元而购买者得到0元。 如果销售者选择发货,则销售者的所得是自己的35元加上购买者支付的35元再减去发货成本20元,共计50元;而此时购买者得到了对她而言价值50元的产品,即所得也为50元。,7,8,电子商务中,购买者处于不利地位。 交付货款后,购买者面临着销售者欺诈(即不发货)的风险。 建立信誉机制的目的是为了提高市场效率。 如果购买者能看到销售者在以往的交易中的发货记录,那么购买者只会从记录良好的销售者手中购买商品。 交易中的欺诈将直接反映在销售者的发货记录中,从而直接降低该销售者以后成交的可能性。,9,二、实验设计,10,我们需要足够的实验局。 每个实验局我们征召8个实验参加者。这8个实验参加者博弈重复进行14轮。 在每一轮中,8个参加者被随机分成4组。 每一组中,销售者/购买者随机决定。 从第2轮起,购买者能看到当前遇到的销售者以往的信誉记录。 如果该销售者以往与某个购买者发生了交易,记录将显示该销售者在交易中是否发货。 信誉记录信息需要购买者主动点击才会看到。,11,12,三、程序设计,13,服务器程序要实现的功能: 实验中信息传递的中转站 要生成数据文件以记录实验结果 要将实验结果通过电脑屏幕随时反映给监控实验的研究人员。,14,创建一个新的VB窗体Rep_Monitor.frm和VB工程Rep_Monitor.vbp,并存放到恰当的目录下。 针对服务器程序需要实现的功能,我们在窗体Rep_Monitor上添加若干个对象。,15,16,17,18,服务器程序的功能细化: 实验开始前,服务器要检查连接状态。当所有实验参加者都和服务器连上,且已作好实验准备时,服务器要发出使实验参加者进入实验状态的指令。 实验开始时,服务器要对参加者进行分组配对。 每一轮开始时,服务器要向参加者发送新一轮的信息。 每一轮结束时,服务器要记录本轮的实验结果。 在各轮进行过程中,服务器要处理购买者(甲)的决策、销售者(乙)的决策,并记录购买者使用信誉系统得情况。,19,20,实验参加者程序要实现向实验参加者传递信息和采集实验参加者的决策两大块功能。 我们创建一个新的VB窗体Rep_Subject.frm和VB工程Rep_Subject.vbp,并存放到恰当的目录下。,21,22,23,24,25,四、程序代码和文档,26,1. 服务器程序Rep_Monitor,27,1.1 对变量和变量组进行定义,28,Option Explicit Dim Period As Integer Dim Arrangement(1 To 14, 1 To 4, 1 To 2) As Integer Arrangement(period, group, role) Dim Choice(1 To 14, 1 To 8) As String choice(period, id) Dim Random(1 To 8) As Single, Position(1 To 8) As Integer Dim Group(1 To 8) As Integer, Role(1 To 8) As Integer Dim FChoice(1 To 8) As String, SChoice(1 To 8) As String Dim FPayoff(1 To 8) As Integer, SPayoff(1 To 8) As Integer, _ TPayoff(1 To 8) As Integer Dim SumUse(1 To 8) As Integer, InfoUse(1 To 8) As Integer Dim CountSChoices As Integer,29,1.2 窗体载入:初始化和实验参加者之间的配对,30,Private Sub Form_Load() Period = 0 frmMonitor.Top = (Screen.Height - frmMonitor.Height) / 2 frmMonitor.Left = (Screen.Width - frmMonitor.Width) / 2 Open “D:Trust_Programresult1.txt“ For Output As #1 Write #1, “Period“, “ID“, “Group“, “Role“, “FChoice“, _ “SChoice“, “FPayoff“, “SPayoff“, “Total Payoff“, “Summary“, “Info“ Close #1 NQmonitor.OpenQueues End Sub,31,1.2.1 随机配对,32,Private Sub Form_Load() Dim i As Integer, j As Integer, k As Integer Dim Differ as Boolean Period = 0 frmMonitor.Top = (Screen.Height - frmMonitor.Height) / 2 frmMonitor.Left = (Screen.Width - frmMonitor.Width) / 2 Open “D:Trust_Programresult1.txt“ For Output As #1 ,33,Write #1, “Period“, “ID“, “Group“, “Role“, “FChoice“, _ “SChoice“, “FPayoff“, “SPayoff“, “Total Payoff“, “Summary“, “Info“ Close #1 For k = 1 To 14 完成各回合的随机配对 For i = 1 To 8 生成8个互不相同的随机数 Differ = True Do Randomize Random(i) = Rnd For j = 1 to i 1 If Random(j) = Random(i) Then Differ = False End If Next j Loop Until Differ Next i Next k,34,Loop Until Differ Next i For i = 1 To 8 将8个参加者的识别号码随机排序 Position(i) = 1 For j = 1 To 8 If Random(j) Random(i) Then Position(i) = Position(i) + 1 End If Next j Next i Next k,35,36,Position(i) = Position(i) + 1 End If Next j Next i For i = 1 To 4 按照排序后的识别号码分组 For j = 1 To 2 Arrangement(k, i, j) = Position(2 * (i - 1) + j) Next j Next i Next k,37,1.2.2 事前配对,38,另一种实验中常见的配对方法是事先将配对方案存入一个数据文件,运行实验时再从数据文件中读取配对方案。,39,40,Close #1 Open “D:Trust_Programmatching8.txt“ For Input As #2 For i = 1 To 14 period For j = 1 To 2 role Input #2, Arrangement(i, 1, j), Arrangement(i, 2, j), _ Arrangement(i, 3, j), Arrangement(i, 4, j) Next j Next i Close #2 NQmonitor.OpenQueues,41,1.3 使实验参加者进入实验状态,42,Private Sub cmdSubUp_Click() Dim i As Integer StartPeriod For i = 1 To 8 NQmonitor.SendMessage 0, “SubEnabled“, i Next i cmdSubUp.Enabled = False End Sub,43,1.4 轮次的开始,44,Private Sub StartPeriod() Dim i As Integer, j As Integer Dim Trustee As Integer Period = Period + 1 For i = 1 To 8 SumUse(i) = 0 InfoUse(i) = 0 Next i CountSChoices = 0 End Sub,45,1.4.1 发送配对信息,46,在语句“CountSChoice = 0” 后面加入以下各行语句: 分配各个实验参加者的角色 For i = 1 To 4 group For j = 1 To 2 role NQmonitor.SendMessage j, “NewPeriod“, _ Arrangement(Period, i, j) Next j Next i,47,1.4.2 向各组中的甲(购买者)发送乙的信誉记录,48,向各组中的甲发送乙的信誉记录 For i = 1 To 4 Trustee = Arrangement(Period, i, 2) For j = 1 To Period - 1 If Choice(j, Trustee) = “C“ Or Choice(j, Trustee) = “D“ Then NQmonitor.SendMessage Choice(j, Trustee) & j, _ “RepInfo“, Arrangement(Period, i, 1) End If Next j Next i,49,1.5 轮次的结束,50,子程序StopPeriod: 各轮结束时,服务器要向各个实验参加者发送本轮的结果。 在服务器的屏幕上,研究人员也需要看到本轮发生的情况。 将本轮的实验结果记录到数据文件中。 服务器要判定当前是否已经到了最后一轮,从而决定是否进行下一轮的实验。,51,1.5.1 向各实验参加者发送实验结果,52,Private Sub StopPeriod() Dim i As Integer, j As Integer Dim Partner As Integer For i = 1 To 4 向所有参加者发送与其同组的人的决策 For j = 1 To 2 Partner = Arrangement(Period, i, 3 - j) NQmonitor.SendMessage Choice(Period, Partner), _ “EndPeriod“, Arrangement(Period, i, j) Next j Next i End Sub,53,1.5.2 在服务器屏幕上显示本轮的实验结果,54,研究人员的屏幕信息 lblPeriod.Caption = Period For i = 1 To 4 For j = 1 To 2 Group(Arrangement(Period, i, j) = i lblGroup(Arrangement(Period, i, j).Caption = i Role(Arrangement(Period, i, j) = j lblRole(Arrangement(Period, i, j).Caption = j Next j Next i For i = 1 To 8 lblFChoice(i).Caption = FChoice(i) lblSChoice(i).Caption = SChoice(i) lblFPayoff(i).Caption = FPayoff(i) lblSPayoff(i).Caption = SPayoff(i) lblTPayoff(i).Caption = TPayoff(i) Next i,55,1.5.3 将实验结果发送到数据文件,56,将实验结果发送至数据文件 Open “D:Trust_Programresult1.txt“ For Append As #3 For i = 1 To 8 Write #3, Period, i, Group(i), Role(i), FChoice(i), SChoice(i), _ FPayoff(i), SPayoff(i), TPayoff(i), SumUse(i), InfoUse(i) Next i Close #3,57,1.5.4 判定是否进入下一轮,58,判定实验是否进入下一轮 If Period 14 Then StartPeriod End If,59,1.6 对新到信息的处理,60,Private Sub NQmonitor_MessageArrived(Message As Variant, MessageType As String, Subject As Integer) Dim i As Integer, j As Integer, k As Integer, Partner As Integer Dim strContent As String End Sub,61,1.6.1 实验参加者与服务器相连,62,局部变量定义语句的后面加入以下选择结构: If MessageType = “SubID“ Then lblID(Subject).Caption = Subject lblIDArrived.Caption = Subject Exit Sub End If,63,1.6.2 处理甲(购买者)所发送的信息,64,If MessageType = “FChoice“ Then strContent = Message Choice(Period, Subject) = strContent For i = 1 To 4 If Arrangement(Period, i, 1) = Subject Then Partner = Arrangement(Period, i, 2) End If Next i FChoice(Subject) = strContent FChoice(Partner) = strContent Exit Sub End If,65,FChoice(Subject) = strContent FChoice(Partner) = strContent If strContent = “A“ Then Choice(Period, Partner) = “O“ SChoice(Subject) = “O“ SChoice(Partner) = “O“ FPayoff(Subject) = 35 FPayoff(Partner) = 35 SPayoff(Subject) = 35 SPayoff(Partner) = 35 TPayoff(Subject) = TPayoff(Subject) + FPayoff(Subject) TPayoff(Partner) = TPayoff(Partner) + SPayoff(Partner) CountSChoices = CountSChoices + 1 End If Exit Sub End If,66,CountSChoices = CountSChoices + 1 End If NQmonitor.SendMessage strContent, “FChoice“, Partner If CountSChoices = 4 Then StopPeriod End If Exit Sub End If,67,1.6.3 处理乙(销售者)所发送的信息,68,If MessageType = “SChoice“ Then strContent = Message Choice(Period, Subject) = strContent For i = 1 To 4 If Arrangement(Period, i, 2) = Subject Then Partner = Arrangement(Period, i, 1) End If Next i SChoice(Subject) = strContent SChoice(Partner) = strContent Exit Sub End If,69,SChoice(Subject) = strContent SChoice(Partner) = strContent If strContent = “C“ Then FPayoff(Subject) = 0 FPayoff(Partner) = 0 SPayoff(Subject) = 70 SPayoff(Partner) = 70 Else FPayoff(Subject) = 50 FPayoff(Partner) = 50 SPayoff(Subject) = 50 SPayoff(Partner) = 50 End If Exit Sub End If,70,SPayoff(Subject) = 50 SPayoff(Partner) = 50 End If TPayoff(Subject) = TPayoff(Subject) + SPayoff(Subject) TPayoff(Partner) = TPayoff(Partner) + FPayoff(Partner) CountSChoices = CountSChoices + 1 If CountSChoices = 4 Then StopPeriod End If Exit Sub End If,71,1.6.3 判定甲是否已查阅乙的信誉记录,72,If MessageType = “SumUse“ Then SumUse(Subject) = 1 Exit Sub End If If MessageType = “InfoUse“ Then InfoUse(Subject) = 1 Exit Sub End If,73,2. 实验参加者程序Rep_Subject,74,2.1 对变量和变量组进行定义,75,Option Explicit Dim Period As Integer Dim Role As String, FChoice As String, SChoice As String Dim OwnPayoff As Integer, PartnerPayoff As Integer, _ TPayoff As Integer Dim NumTrustee As Integer, NumReturn As Integer,76,2.2 窗体的载入,77,Private Sub Form_Load() txtHistory.Text = “轮次 你的角色 甲的决策 乙的决策 “ _ & “你的所得 对方所得 你的累积所得“ & _ “ -“ & vbCrLf Period = 0 TPayoff = 0 frmTrust.Top = (Screen.Height - frmTrust.Height) / 2 frmTrust.Left = (Screen.Width - frmTrust.Width) / 2 End Sub,78,frmTrust.Top = (Screen.Height - frmTrust.Height) / 2 frmTrust.Left = (Screen.Width - frmTrust.Width) / 2 txtHistory.Locked = True txtInfo.Locked = True cmdA.Enabled = False cmdB.Enabled = False cmdSum.Enabled = False cmdInfo.Enabled = False End Sub,79,cmdSum.Enabled = False cmdInfo.Enabled = False lblRound.Visible = False lblRole.Visible = False lblHistory.Visible = False lblYourChoice.Visible = False cmdA.Visible = False cmdB.Visible = False lblFChoice.Visible = False txtHistory.Visible = False lblInfo.Visible = False cmdSum.Visible = False cmdInfo.Visible = False lblSummary.Visible = False txtInfo.Visible = False End Sub,80,lblSummary.Visible = False txtInfo.Visible = False If (Len(Command) = 0) Then Dim ip As String ip = InputBox(“Monitor“, “Monitor“, “10.1.1.1“) NQsubject.mqserver = ip & “:2955“ Else NQsubject.mqserver = Command & “:2955“ End If End Sub,81,2.3 将实验参加者与服务器相连,82,Private Sub cmdOK_Click() cmdOK.Enabled = False NQsubject.SubjectNumber = CInt(txtID.Text) NQsubject.ConnectQueues NQsubject.SendMessage 0, “SubID“ txtID.Enabled = False txtID.Visible = False cmdOK.Visible = False End Sub,83,2.4实验参加者进行决策,84,Private Sub cmdA_Click() cmdA.Enabled = False cmdB.Enabled = False If cmdA.Caption = “A“ Then cmdSum.Enabled = False cmdInfo.Enabled = False NQsubject.SendMessage “A“, “FChoice“ FChoice = “A “ SChoice = “-“ OwnPayoff = 35 PartnerPayoff = 35 Else NQsubject.SendMessage “C“, “SChoice“ FChoice = “B “ SChoice = “C “ OwnPayoff = 70 PartnerPayoff = 0 End If TPayoff = TPayoff + OwnPayoff End Sub,85,Private Sub cmdB_Click() cmdA.Enabled = False cmdB.Enabled = False If cmdB.Caption = “B“ Then cmdSum.Enabled = False cmdInfo.Enabled = False NQsubject.SendMessage “B“, “FChoice“ Else NQsubject.SendMessage “D“, “SChoice“ FChoice = “B “ SChoice = “D “ OwnPayoff = 50 PartnerPayoff = 50 TPayoff = TPayoff + OwnPayoff End If End Sub,86,2.5 甲(购买者)决策前参考乙的信誉记录,87,Private Sub cmdSum_Click() cmdSum.Enabled = False lblSummary.Visible = True NQsubject.SendMessage 0, “SumUse“ End Sub,88,Private Sub cmdInfo_Click() cmdInfo.Enabled = False txtInfo.Visible = True NQsubject.SendMessage 0, “InfoUse“ End Sub,89,2.6 对新到信息的处理,90,Private Sub NQsubject_MessageArrived(Message As Variant, MessageType As String) Dim i As Integer, j As Integer Dim strContent As String End Sub,91,2.6.1 实验参加者进入实验状态,92,在NQsubject_MessageArrived事件内加入以下选择结构: If MessageType = “SubEnabled“ Then lblRound.Visible = True lblRole.Visible = True lblHistory.Visible = True txtHistory.Visible = True If Role = “甲“ Then cmdA.Enabled = True cmdB.Enabled = True lblYourChoice.Caption = “你的决策是:“ lblYourChoice.Visible = True cmdA.Visible = True cmdB.Visible = True lblInfo.Visible = True cmdSum.Visible = True cmdInfo.Visible = True End If Exit Sub End If,93,2.6.2 接收信誉记录信息,94,If MessageType = “RepInfo“ Then NumTrustee = NumTrustee + 1 strContent = Message j = CInt(Mid(strContent, 2) Exit Sub End If,95,j = CInt(Mid(strContent, 2) If Left(strContent, 1) = “C“ Then If txtInfo.Text = “无相关信息“ Then txtInfo.Text = “第 “ & j & “ 轮:选择C“ & vbCrLf Else txtInfo.Text = txtInfo.Text & “第 “ & j & “ 轮:选择C“ _ & vbCrLf End If Else If txtInfo.Text = “无相关信息“ Then txtInfo.Text = “第 “ & j & “ 轮:选择D“ & vbCrLf Else txtInfo.Text = txtInfo.Text & “第 “ & j & “ 轮:选择D“ _ & vbCrLf End If NumReturn = NumReturn + 1 End If i = NumTrustee - NumReturn lblSummary.Caption = “与你配对的乙在过去共 “ & i & “次选C “ _ & NumReturn & “次选D“ Exit Sub,96,2.6.3 新轮次的开始,97,If MessageType = “NewPeriod“ Then Period = Period + 1 lblRound.Caption = “第“ & Period & “轮“ lblSummary.Caption = “无相关信息“ txtInfo.Text = “无相关信息“ lblSummary.Visible = False txtInfo.Visible = False lblFChoice.Visible = False NumTrustee = 0 NumReturn = 0 strContent = Message Exit Sub End If,98,strContent = Message If CInt(strContent) = 1 Then Role = “甲“ cmdA.Caption = “A“ cmdB.Caption = “B“ lblRole.Caption = “你在本轮为甲“ Else Role = “乙“ cmdA.Caption = “C“ cmdB.Caption = “D“ lblRole.Caption = “你在本轮为乙“ End If,99,lblRole.Caption = “你在本轮为乙“ End If If Period 1 Then If Role = “甲“ Then lblYourChoice.Caption = “你的决策是:“ lblYourChoice.Visible = True cmdA.Visible = True cmdB.Visible = True lblInfo.Visible = True cmdSum.Visible = True cmdInfo.Visible = True cmdA.Enabled = True cmdB.Enabled = True cmdSum.Enabled = True cmdInfo.Enabled = True Else cmdA.Enabled = False cmdB.Enabled = False cmdSum.Enable

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论