/* SETUP.GPR: program to set up global variables and parameter settings for prisoners dilemman problem John Rust, University of Maryland, October, 2006 */ /* parameters determining the prisoners' payoff (for details, see writeup in J. Rust 2006, "prisoners_dilemma.tex" and gameprob.html) */ cc_a=-2; /* p a's coefficient on x_a, if both confess */ cc_b=-2; /* p b's coefficient on x_b, if both confess */ dd_a=-1; /* p a's coefficient on x_a, if both don't confess */ dd_b=-1; /* p b's coefficient on x_b, if both don't confess */ cd_a=-1/2; /* p a's coefficient on x_a, if a confesses, b doesn't */ dc_b=-1/2; /* p b's coefficient on x_b, if a doesn't confess, b does */ cd_b=-5; /* p b's coefficient on x_b, if a confesses, b doesn't */ dc_a=-5; /* p a's coefficient on x_a, if a doesn't confess, b does */ sig_a=1; /* scale parameter for Type 3 EV unobserved type for player a */ sig_b=1; /* scale parameter for Type 3 EV unobserved type for player b */ nobs=500; x_a=rndu(nobs,1); /* generate x_a's at random: x_a is player a's observed type */ x_b=rndu(nobs,1); /* generate x_b's at random: x_b is player b's observed type */ save x_a,x_b; /* parameter vector to be estimated: q (2x1) for symmetric * specification q[1]=dd_b-dc_b=dd_a-cd_a q[2]=cd_b-cc_b+cd_b-dd_b = dc_a-cc_a+cd_a-dd_a */ q=zeros(2,1); q[1]=dd_b-dc_b; q[2]=cd_b-cc_b-q[1]; qa=q; qb=q; /* algorithm parameters */ npemeth="kernel"; /* non-parametric estimation method to use to estimate the choice probabilities in the semi-parametric two step estimation approach (see, eg. the 'semi' and 'semifl' options for the mctype variable in the montecarlo.gpr program). The various nonparametric methods are explained in the answers to this problem, prisoners_dilemman.tex. true: use the true equilibrium choice probabilities (this is an infeasible estimator except in monte carlo exercises where the data are generated from some computed "true model") kernel: nonparametric regression using kernel density series: nonparametric estimation of logit choice probabilities using a series expansion in (x_a,x_b) llr: local linear regression of the conditional choice probabilities treated as a unknown regression function lll: locally linear maximum likelihood estimation of a binary logit model */ /* the following parameters are not relevant if npemeth="true" or npemeth="series" */ kerneltyp="gaussian"; /* type of kernel to use for nonparametric estimates: gaussian (for gaussian kernel) epanechinkov (for Epanechinikov kernel) tricube (for tricube kernel, see Fan and Gijbels, Local Polynomial Modelling, Chapman and Hall p. 24*/ mvkernel="unidist"; /* type of multivariate kernel for multivariate problems: unidist: use unidimensional kernel with the Euclidean distance between data and point x where kernel is evaluated at product: use a product of unidimensional kernels */ bwrule="optimal"; /* rule for setting bandwidths for kernels: optimal : optimal bandwidths from Table 4.1 in Silverman adaptive: adaptive bandwidth from Fan and Gijbels eq. 7.34 */ debg=0; /* debug switch: set to 1 to print optimization iterations in br_c.g and br_s.g */ debg_e=0; /* debug switch for the equil.g program: 1 to display iterations, 0 to run quietly */ /* these parameters are for the best response functions for players a and b i.e. br_a.g and br_b.g */ ngrids=30; /* number of points to search in an initial gridsearch over interval (0,1), for initial gridsearch before switching to Newton's method to calculate equilibrium probabilities of confessing */ gridtol=1e-6; /* grid search stops once the market share is less than this value */ /* these parameters are for the calculation of the Bayesian Nash equilibrium of the prisoner's dilemma game in equil.g */ findall=1; /* set to 1 to try to find all Nash equilibria of the prisoner's dilemma game in equil.g. This slows the runtimes of this algorithm, but is safer in cases where one does not have any a priori knowlege about whether the equilibrium is unique or not */ sa_steps=20; /* maximum number of successive approximation steps to use before switching to Newton algorithm in equil.g to compute equilibrium to the prisoners dilemma game. Code also check sa_tol and stops successive approximations when the number of iterations reaches sa_steps or the change in prices is less than sa_tol, whichever comes first */ sa_tol=.05; /* convergence tolerance for successive approximation steps in equil.g. As noted above, code starts with successive approximations and then switches to Newton's method to solve for equilibrium as part of a more robust approach to finding equilibrium. Also in difficult cases where there may be multiple equilibria, an initial grid search may also be employed as part of a strategy to find all equilibria. But initially for speed and for problems where prior information or computational experience indicates a unique equilibrium, then Newton's method generally converges the fastest and the prior grid search and use of successive approximations is unnecessary */ ctol=1e-6; /* convergence tolerance for Newton algorithm */ maxnewts=100; /* maximum number of Newton steps before terminating (if Newton does not terminate due to change in iterations less than ctol, it is an indication of a problem and a warning message is printed) */