/* BR_B.G: best response function for player b (column player) in the prisoners dilemma game John Rust, University of Maryland, November 2005 */ proc (2)=br_b(p_a,x_b); /* x_b is player a's observable type and p_a is player b's belief about the probablity that prisoner a will confess. Procedure returns the probability that prisoner b will confess, representing the optimal decision rule for prisoner a whether to confess or not confess, with prisoner b's private information "integrated out". Implicitly passed global: sig_b: scale parameter for prisoner b's private information (Type III extreme value distribution) returned values: p: best response probability (of confessing) df: derivative of best response probability with respect to p_a */ local df,p; /* p=1/(1+exp((eu_b(0,x_b,p_a)-eu_b(1,x_b,p_a))/sig_b)); df=u_b(0,1,x_b)-u_b(0,0,x_b)-u_b(1,1,x_b)+u_b(1,0,x_b); df=-p*(1-p)*df/sig_b; */ p=1/(1+exp(qb[1]*x_b+qb[2]*x_b*p_a)); df=-p*(1-p)*qb[2]*x_b; retp(p,df); endp;