/* BR_A.G: best response function for player a (row player) in the prisoners dilemma game John Rust, University of Maryland, November 2005 */ proc (2)=br_a(p_b,x_a); /* x_a is player a's observable type and p_b is player a's belief about the probablity that prisoner b will confess. Procedure returns the probability that prisoner a will confess, representing the optimal decision rule for prisoner a whether to confess or not confess, with prisoner a's private information "integrated out". Implicitly passed global: sig_a: scale parameter for prisoner a'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_b */ local df,p; /* p=1/(1+exp((eu_a(0,x_a,p_b)-eu_a(1,x_a,p_b))/sig_a)); df=u_a(0,1,x_a)-u_a(0,0,x_a)-u_a(1,1,x_a)+u_a(1,0,x_a); df=-p*(1-p)*df/sig_a; */ p=1/(1+exp(qa[1]*x_a+qa[2]*x_a*p_b)); df=-p*(1-p)*qa[2]*x_a; retp(p,df); endp;