On this page, I have listed some “public goods” that I’ve made. The idea is that these are useful/interesting to me, and they may be useful/interesting to you, too!
Serial dictator program
I wrote this program to help with assigning papers to reviewers for a peer review group I helped start.
The program is written in the wonderful Julia language, but I will happily translate it to other languages (most easily in R or Stata) if there is a demand!
The serial dictator mechanism is used to fairly assign each reviewer a paper to review. The reviewers are given a list of papers, and they submit a rank ordered list. These lists are then fed into the mechanism and a fair allocation is output!
How the serial dictator works: an example
To illustrate, assume there are three papers to be assigned ${a,b,c}$ and three potential reviewers ${1,2,3}$. Reviewer $i$’s preferences are denoted by $P_i$. For this example, I’ll use the following preferences:
\[\begin{array}{ccc} P_1 & P_2 & P_3 \\ \hline a & a & b \\ b & c & a \\ c & b & c \end{array}\]To get the best possible allocation, the allocator wants to consider consider all possible orders of dictatorship. With three potential reviewers, these are:
\[\begin{array}{rl} \text{order 1}: & 1 \to 2 \to 3 \\ \text{order 2}: & 1 \to 3 \to 2 \\ \text{order 3}: & 2 \to 1 \to 3 \\ \text{order 4}: & 2 \to 3 \to 1 \\ \text{order 5}: & 3 \to 1 \to 2 \\ \text{order 6}: & 3 \to 2 \to 1 \end{array}\]The allocation of dictator order $k$ for individual $i$ is denoted $\mu_k(i)$.
I’ll illustrate with order 1. The mechanism works according to the following steps:
- Define the set of available objects as $A_1 = {1,2,3}$
- Person 1 chooses first. All objects are in the available set, so she gets her most preferred item. So, $\mu_1(1) = a$. Update the set of available objects to be $A_2 = A_1 \setminus {\mu_1(1)}$.
- Person 2 chooses her most preferred item from $A_2$. Her most preferred item is not available, so she gets her second-most preferred item. So, $\mu_1(2) = c$. Update the set of available objects to be $A_3 = A_2 \setminus {\mu_1(1), \mu_1(2)}$.
- There is only one item in the available set, so the third person is assigned that item. So $\mu_1(3) = b$. (her most preferred!)
The final allocation for dictator order 1 is $\mu_1 = (a,c,b)$.
How well off are the people under this allocation? A simple way to calculate an individual’s welfare is to subtract 4 (the number of objects + 1) from the ranking of their allocation. We’ll call this the “payoff” to the individual.
Let $P_i(\mu_1)$ be the ranking of person $i$’s allocated object; their payoff is then $4 - P_i(\mu_1)$. The total welfare of the allocation for serial dictator order $k$ is \(V_k = \sum_{i=1}^3 \left(4 - P_i(\mu_k)\right).\) This means order 1 has a payoff of 5.
How you can use this program
The program goes through all permutations of dictatorship orders to find the one that maximizes payoff defined in this way. Note that the program can handle a larger number of individuals than objects, but it cannot allocate more objects than there are people. This is mainly because everybody who submitted a paper for review was required to be a reviewer, so there was by design always at least as many reviewers as there were papers.
Another peculiarity about this program is that everybody must rank every object. In many cases, a person may deem only a small number of objects better than nothing. Because my peer review group required everyone participating to review a paper, everybody submitted a complete ranking.
I find it interesting to see how “popular” the papers were, so the program saves a histogram table as a CSV.
This table is called rank-counts.csv.
The main allocation is saved in serial-dictator-allocation.csv and can be easily opened in Excel or Google Sheets.
You will need to provide three parameters at the start of the program: indir, outdir, and filename. These are, respectively, the directory containing your preferences CSV, the directory where you would like the allocation saved, and the name of the CSV containing your preferences.
Update these parameters and you’re good to go!
Program download (and sample data)
Download the program here and use this example data to see how it works!
Note that to use it, you should upload a CSV with column names that are the names of individuals and their preferences descending in favorability. For example, the data for a 4-person, 3-object setting should look like the table below:
| Adam | Bob | Candace | David |
|---|---|---|---|
| Adam's first choice | Bob's first choice | Candace's first choice | David's first choice |
| Adam's second choice | Bob's second choice | Candace's second choice | David's second choice |
| Adam's third choice | Bob's third choice | Candace's third choice | David's third choice |