Matching Markets Jonathan Levin Economics 136 Winter 2010 National Residency Match Doctors in U.S. and other countries work as hospital “residents” after graduating from medical school. In the US, about 15,000 US med students and many foreigntrained doctors seek residencies each year. About 4000 hospitals try to fill 20,000+ positions. Market operates as a central clearinghouse Students apply and interview at hospitals in the fall. In February, students and hospitals state their preferences Each student submits rank-order list of hospitals Each hospital submits rank-order list of students Computer algorithm generates an assignment. Why run a market this way? Does it make sense? History of NRMP It wasn’t always this way. Historically, medical students found residencies through a completely decentralized process. But there were problems: students and hospitals made contracts earlier and earlier, eventually in second year of med school! Hospitals decided to change the system by adopting a centralized clearinghouse. National Residency Matching Program (NRMP) adopted, after various adjustments in 1952. System has persisted, though with some modification in late 1990s to handle couples and some recent debate about salaries. In the early 1980s, it was realized that the NRMP was using an algorithm proposed by David Gale and Lloyd Shapley in 1962. Properties they discovered may help explain NRMP success. School Choice Most US cities have historically assigned children to neighborhood schools. Recently, many cities have adopted school choice programs, that try to account for the preferences of children and their parents. School authorities hope choice will lead to more efficient placements without sacrificing fairness or creating confusion. Problem seems similar to residency assignment The most commonly used mechanism, however, is quite different, and arguably has less desirable properties. Maybe cities should redesign their programs? In fact, NYC recently adopted Gale-Shapley algorithm. As it turns out, school choice is not exactly the same as the residency problem, and maybe improvements are still possible… Kidney Exchanges More than 75,000 people in the United States are waiting to receive a kidney transplant. There is a shortage of donors Deceased donors (maybe 10,000 a year) Living donors (maybe 7000 a year). In 2005, 4200 patients died on the wait list. Problem is not just straight supply and demand Donor kidney needs to be compatible with the patient. So sometimes patient has a living donor, but can’t use the kidney because of incompatibility. Maybe two patients could trade donor kidneys, or several patients could engage in a kidney exchange. It turns out that matching theory can also help us understand this problem, and make optimal use of a limited pool of donors. Matching applications galore! What are the common features of these problems? Two sides of the market to be matched. Participants on at least one side, and sometimes on both sides care about to whom they are matched. For whatever reason, money cannot be used to determine the assignment. (Why not?) Other examples Housing assignment College admissions Fraternity/sorority rush Judicial clerkships MBA course allocation Military postings Dating websites NCAA football bowls Matching Theory Marriage Model Participants Set of men M, with typical man mM Set of women W, with typical woman w W. One-to-one matching: each man can be matched to one woman, and vice-versa. Preferences Each man has strict preferences over women, and vice versa. A woman w is acceptable to m if m prefers w to being unmatched. Matching A matching is a set of pairs (m,w) such that each individual has one partner. If the match includes (m,m) then m is unmatched. A matching is stable if Every individual is matched with an acceptable partner. There is no man-woman pair, each of whom would prefer to match with each other rather than their assigned partner. If such a pair exists, they are a blocking pair and the match is unstable. Examples Two men m,m’ and two women w,w’ Example 1 m prefers w to w’ and m’ prefers w’ to w w prefers m to m’ and w’ prefers m’ to m Unique stable match: (m,w) and (m’,w’) Example 2 m prefers w to w’ and m’ prefers w’ to w w prefers m’ to m and w’ prefers m to m’ Two stable matches {(m,w),(m’,w’)} and {(m,w’),(m’,w)} First match is better for the men, second for the women. Is there always a stable match? Deferred Acceptance Algorithm Men and women rank all potential partners Algorithm Each man proposes to highest woman on his list Women make a “tentative match” based on their preferred offer, and reject other offers, or all if none are acceptable. Each rejected man removes woman from his list, and makes a new offer. Continue until no more rejections or offers, at which point implement tentative matches. This is the “man-proposing” version of the algorithm; there is also a “woman proposing” version. DA in pictures Stable matchings exist Theorem. The outcome of the DA algorithm is a stable one-to-one matching (so a stable match exists). Proof. Algorithm must end in a finite number of rounds. Suppose m, w are matched, but m prefers w’. At some point, m proposed to w’ and was rejected. At that point, w’ preferred her tentative match to m. As algorithm goes forward, w’ can only do better. So w’ prefers her final match to m. Therefore, there are NO BLOCKING PAIRS. Aside: the roommate problem Suppose a group of students are to be matched to roommates, two in each room. Example with four students A prefers B>C>D B prefers C>A>D C prefers A>B>D No stable match exists: whoever is paired with D wants to change and can find a willing partner. So stability in matching markets is not a given, even if each match involves just two people. Why stability? Stability seems to explain at least in part why some mechanisms have stayed in use. If a market results in stable outcomes, there is no incentive for re-contracting. Roth (1984) argues that stability of NRMP (which uses Gale-Shapley) helps explain why it has “stuck” as an institution. When we look at related markets, many though not all unstable matching mechanisms have failed. What would be an alternative? Decentralized market What if there is no clearinghouse? Men make offers to women Women consider their offers, perhaps some accept and some reject. Men make further offers, etc.. What kind of problems can arise? Maybe w holds m’s offer for a long time, and then rejects it, but only after market has cleared. Maybe m makes exploding offer to w and she has to decide before knowing her other options. In general, no guarantee the market will be orderly… Priority matching Under priority matching, men and women submit preferences, Each man-woman pair is given a priority based on their mutual rankings. The algorithm matches all priority 1 couples and takes them out of the market. New priorities are assigned and process iterates. Example: Assign priority based on product of the two rankings, so that priority order is 1-1, 2-1, 1-2, 1-3, 3-1, 4-1, 2-2, 1-4, 5-1, etc… Algorithm implements all “top-top” matches, then conditional toptops, etc. When none remain, look for 2-1 matches, etc. Will this lead to a stable matching? Failure of priority matching Roth (1991, AER) studied residency matches in Britain, which are local and have used different types of algorithms --- a “natural experiment”. Newcastle introduced priority matching in 1967. By 1981, 80% of the preferences submitted contained only a single first choice. The participants had pre-contracted in advance! This is the type of “market unraveling” that plagued the US residency market prior to the NRMP. We’ll have more to say about unraveling later. Success of stable mechanisms Market Stable? Still Used? NRMP yes yes US Medical Specialties (about 30) yes yes* Edinburgh yes yes Cardiff yes yes Birmingham no no Newcastle no no Sheffield no no Cambridge no yes London hospital no yes Canadian lawyers yes yes* Pharmacists yes yes Reform rabbis yes yes Clinical psychologists yes yes UK Residency matches (Roth, 1991) Optimal stable matchings A stable matching is man-optimal if every man prefers his partner to any partner he could possibly have in a stable matching. Theorem. The man-proposing DA algorithm results in a man-optimal stable matching. This matching is also woman-pessimal (each woman gets worst outcome in any stable matching). Note: the same result holds for woman-proposing GS with everything flipped. Proof Say that w is possible for m if (m,w) in some stable matching. Proof: show by induction that no man is ever rejected by a woman who is possible for him. Suppose this is the case through round n. Suppose at round n+1, woman w rejects m in favor of m’. Can there be a stable match that includes (w,m)? If so, m’ must be matched with some w’ who he prefers to w and who is possible for him (or else w,m’ block). But then m’ could not be making an offer to w in round n+1: m’ would have first extended an offer to w’ and would not have been turned away. So in no round is a man rejected by a possible woman. Rural Hospital Theorem Some years ago, there were a set of hospitals, mostly in rural areas, that had trouble filling their positions and were not happy. Question: would changing around the algorithm help these hospitals? Theorem. The set of men and women who are unmatched is the same in all stable matchings. Proof of RH Theorem Consider the man-optimal stable matching and some other stable matching. Any man who is matched in the other matching, must be matched in the man-optimal matching, so at least as many men are matched in the man-optimal. Any woman matched in the man-optimal matching must be matched in all other stable matchings. In any stable matching, the number of matched men just equals the number of matched women. So the same set of men and women are matched in the two matchings, although different pairings. Strategic Behavior The Gale-Shapley algorithm (and other mechanisms such as priority matching) asks participants to report their preferences. What is a good strategy? Should participants report truthfully? Definitions A matching mechanism is a mechanism that maps reported preferences into an assignment. A mechanism is strategy-proof if for each participant it is a dominant strategy to report true preferences (i.e. optimal regardless of the reports of others). DA is not strategy-proof Example (two men, two women) m prefers w to w’ m’ prefers w’ to w w prefers m’ to m w’ prefers m to m’ Under man-proposing DA algorithm If everyone reports truthfullly: (m,w),(m’,w’) If w reports that m is unacceptable, the outcome is instead (m,w’),(m’,w) --- better for w! Strategic behavior The example on the previous slide can be used to establish the following result (try it on your own, or see RS). Theorem. There is no matching mechanism that is strategy-proof and always generates stable outcomes given reported preferences. Both version of DA lead to stable matches, so they are not strategy-proof! Truncation strategies In the “man-proposing” DA, a woman can game the system by truncating her rank-order list, and stopping with the man who is the best achievable for her in any stable match. Theorem. Under the man-proposing DA, if all other participants are truthful, a woman can achieve her best “possible” man using the above strategy. Question: how likely is it that one would have the information to pull off this kind of manipulation? Proof The DA must yield a stable matching. If participants report as in Thm, one stable matching is the woman-optimal matching under the original true preferences. This gives the manipulator her best possible man. Under the reported preferences, any other matching would have to give the woman either someone better, or leave her unmatched. By the RH theorem, she can’t be unmatched in some other stable matching. She also can’t get someone better because whatever would block under the true preferences will block under the reports. Therefore, she must get her best possible man! How many stable matchings? Evidently, the incentives and scope for manipulation depend on whether preferences are such that there are many stable matchings. If there is a unique stable match given true preferences, there is no incentive to manipulate if others are reporting truthfully. When might we have a unique stable match? Ex: if all women rank men the same, or vice-versa. In “large” markets? We’ll come back to this later. DA is strategy-proof for men Theorem (Dubins and Freedman; Roth). The men proposing deferred acceptance algorithm is strategy-proof for the men. Proof. Fix the reports if all the women and all but one man. Show that whatever report the man m starts with, he can make a series of (weak) improvements leading to a truthful report. Proof Suppose man m is considering a strategy that leads to a match x where he gets w. Each of the following changes improves his outcome Reporting that w is his only acceptable woman. x is still unblocked. By RH, m must get matched, and so must get w. Reporting honestly, but truncating at w. m being unmatched is still blocked (because it was blocked if m reported just w), so m must do at least as well as w. Reporting honestly with no truncation. This won’t affect DA relative to above strategy. Many-to-One Matching Many-to-One Matching In the NRMP, the hospitals actually want to hire several doctors. How to extend the theory for account for this? Simplest extension Doctors have strict preference over hospitals Hospitals have a quota of spaces and a strict ranking of doctors. Stability defined similarly: no hospital can find a doctor post-match and make a mutually agreeable contract Note: bilateral and “group” stability are the same here. Extended DA Algorithm Doctors and hospitals submit rankings Algorithm Each hospital proposes to its preferred doctors. Doctors make a “tentative match” based on their preferred offer, and reject other offers, or all if none are acceptable. Each hospital receiving rejections removes these doctors from its list and makes new offers from lower down. Continue until no more rejections or offers, at which point implement tentative matches. There is also a doctor-proposing version. Properties of Many-to-One DA Think of a hospital with q positions as q hospitals each with one position. Many results carry over At least one stable matching exists. Hospital proposing DA results in hospital-optimal stable matching (same for doctor-proposing). Rural hospital theorem: all hospitals fill the same number of positions across stable matchings and the same doctors are assigned a position. But some do not No stable mechanism is strategy-proof for the hospitals, even the hospital-proposing DA algorithm… Hospital Incentives in DA Example Student 1: H3, H1, H2 Student 2: H2, H1, H3 Student 3: H1, H3, H2 Hospital 1: s1, s2, s3, s4 (quota=2) Hospital 2: s1, s2, s3, s4 (quota=1) Hospital 3: s3, s1, s2, s4 (quota=1) Student 4: H1, H2, H3 Unique stable matching: (H1,s3,s4), (H2,s2), (H3,s1). If H1 submits preferences s1,s4, the unique stable matching becomes (H1,s1,s4), (H2,s2), (H3,s3). More General Preferences What if hospitals (or, say, schools) care about the composition of their class? Maybe a hospital wants to balance research-oriented and clinically-oriented residents. A public school may want to balance local students and high academic achievers. Preferences are more complicated than a quota and a rank-order list. In general, a preference ranking for a hospital is a an ordered list of sets of residents, e.g. {r1,r2}, {r1}, {r2}, . Turns out to be subtle to extend the theory to this case. Substitutable preferences Let ch(A) denote the set of students that hospital h would select given a choice of any set of students in A, and Rh(A)=A - ch(A). Hospital h has substitutes preferences if A A’ implies that Rh(A) Rh(A’). That is: if the set of students available to h expands, so does the set of students that h rejects, i.e. h does not add students who it previously rejected. Substitutes and “No Regret” Theorem. Suppose hospitals have substitutes preferences. Then a stable match exists and can be found with the DA algorithm. Proof. Consider the student-proposing algorithm. If a hospital rejects a student at round n, then if an any subsequent round the that same student made a new offer to the hospital, the hospital would still reject them This holds after algorithm ends, so result is stable. Key idea: hospital never “regrets” making a rejection, which clearly is also the case in the one-to-one case. Note that regret can occur if substitutes fails – e.g. if a hospital wants students 1 and 2 together, but neither individually. Further issues: Couples In the residency match, there are a fair number of married couples (maybe 500). Typically couples want to be in the same city or at the same hospital. The DA algorithm doesn’t account for this; it might put a husband in Boston and wife in Chicago. Problem: there may be no stable match! Couples: an example Couple c1,c2 and single student s Two hospitals, each hiring one student Hospital 1: c1, s Hospital 2: s, c2 Single student: H1, H2 Couple prefers positions at H1, H2 or nothing. There is no stable match! (Check) Medical Residents Back to the NRMP Starting in the 1970s and accelerating into the 1990s, many couples started to go around the NRMP to find positions. NRMP decided to investigate and ultimately re-design the match Roth-Peranson (AER, 1998) describe this. Let’s look at a few of the interesting findings. Some NRMP statistics 1987 1993 1994 1995 1996 Applicants Applicants with ROLs 20,071 20,916 22,353 22,937 24,749 Applicants in couples 694 854 892 998 1008 3170 3622 3662 3745 3758 Programs Programs with ROL Spaces offfered 19,973 22,737 22,801 22,806 22,578 Questions Taking stated preferences as the truth… Is there always a stable match? Are there many possible stable matches? Can students/hospitals gain from mistating? Any difference between student proposing and hospital proposing DA? Hospital-proposing was in use. Difference between hospital/doctor DAs 1987 1993 1994 1995 1996 Applicants affected 20 16 20 14 21 Prefer Doctor-Proposing 12 16 11 14 12 Programs Affected 20 15 23 15 19 Prefer Hospital-Proposing 12 15 11 14 9 Applicants Programs What do we learn? Few participants could gain by manipulating their ROLs Between 0 and 22 doctors out of 20,000 depending on year and form of DA. Between 12 and 36 hospitals out of 4,000 depending on year and form of DA. Despite the possibility that having couples would lead to no stable match, one can be found each year. Simulations with randomly drawn preferences confirm these findings Each doctor draws k hospitals randomly to rank Each hospital randomly ranks all students. Large markets: Incentives Consider a sequence of markets with n men and n women, where for each n, each participant’s preferences are drawn from a uniform distribution over the possible rankings. Theorem. As n, the expected proportion of females who can manipulate the man-proposing DA goes to zero. This result is due to Immorlica and Mahdian (2005) and, for many-to-one, Kojima and Pathak (2009). Proof (sketch) Can focus on manipulation by truncation Truncation may help because… w rejects offer of M-optimal match partner m m makes an offer to some w’, who rejects m’ m’ makes an offer to some w’’, who rejects w’’ …. mk makes an offer to w, who w prefers to m. What is the probability that for a given woman w, rejecting her M-optimal match partner creates such as cycle? In a large market, very very small. Large markets: Couples Consider a sequence of n markets similar to above with a fixed number of couples, independent of n. Theorem. As n, the probability that a stable matching exists converges to one. This result is due to Kojima, Pathak and Roth (in progress) – I think the intuition is similar. Stability fails if a couple gets displaced by a single doctor d, leading the other couple member to leave her hospital, either directly or through a chain of offers to displace d, which causes the original hospitals to re-hire the couple. In a large market, the probability of this kind of cycle becomes very very small. The Core In cooperative games, the core is a solution concept describing “stable” outcomes (like Nash eqm in noncooperative games). Consider a candidate assignment in the house problem: A coalition of agents blocks if, from their initial endowments, there is an assignment among themselves that they all prefer to the candidate assignment. The core consists of all feasible unblocked assignments. What’s the difference between core & stability? Stability is ex post (no more trade), core is ex ante (diff. trade) But closely related: no difference in the marriage or roommate problems, and in more generally, if there are no externalities, unstable allocations are blocked by coalition of the whole. School Choice Background In US and many other countries, children historically have gone to neighborhood schools. Recently, many US cities have adopted school choice programs, designed to give families additional flexibility, and maybe create some competition between schools. What are important considerations in design? Aim for efficient placements “Fair” procedure and outcomes Mechanisms that are easy to understand and use. Background, cont. Abdulkadiroglu and Sonmez (2003, AER) showed that placement mechanisms used in many cities, such as Boston, are flawed, and proposed alternative mechanisms. This has led many cities, including Boston and New York, to adopt new mechanisms. This is an active area of research Designing improved mechanisms Studying the performance of mechanisms in use. Also, partially random nature of allocations has facilated studies of school effectiveness in training students. School Choice Model Set of students S and schools C Each student can go to one school Each school can admit qc students Each student has strict preferences over schools and over being unmatched. Each school has a strict “priority order” over students. This is the many-to-one model we looked at earlier. Stability means: (a) no blocking individual, and (b) no blocking pair – no student that can find a school that will displace someone to accept that student. Stability as Fairness No blocking individual means no student can be forced to attend a school they don’t want to attend, and no school can be forced to take a student they view as unqualified. No blocking pair means no justified envy. That is, there is no student s who gets a school they prefer less than c, only to see a student with lower priority end up at c. Boston Mechanism Each student submits a preference ranking. Consider only the top choices of the students. For each school, assign seats to students that ranked it first according to priority order. Stop if all seats assigned or run out of students ranking it first. Consider remaining students, and their second choices. Repeat the above process. Continue with third choices and so on… Problems with Boston Boston mechanism is not strategy-proof. If you don’t put your priority school high on your rank list, you may lose it! This was well-understood by Boston parents, and frequently showed up on parent message boards. Boston mechanism is also unfair… Doesn’t lead to stable outcomes. Disadvantages families that don’t know how to game the system. Boston in Practice Students in K,6,9 submit preferences Students have priorities as follows Students already at a school. Students in the walk zone and siblings at school Students with siblings at school Students in the walk zone Everyone else Abdulkadiroglu et al. found that 19% listed two overdemanded schools as top two choices and about a quarter ended up unassigned – ugh. Columbus (OH) Schools Each student applies to up to three schools. For some schools, seats are guaranteed based on assignment area. Once those are filled, a lottery is held at each school and offers are made. A student with an offer has three days to decide. If she says yes, she’s removed from the system. Process repeats. Ugh again… NYC Schools Each student (90,000 plus applying to high schools) can submit up to five applications. Each school receives applications and makes offers, plus it makes a waiting list. Students accept and reject offers. Schools make offers from wait lists (three rounds) Roughly 30,000 students would be unassigned at the end; they would be administratively assigned. Ugh, again… there must be a better way. Student Proposing DA What about the student proposing DA? We know this leads to a stable match. And the stable match that is best for all the students, and they are the ones whose welfare we care about. Plus it’s strategy-proof for the students, and we may not be worried about schools if priorities are clearly stated. So our earlier results indicate that student-proposing DA has attractive properties… We’ll see shortly that Boston and NYC have adopted it. But is it efficient? Stable matches can be inefficient Consider students s1,s2,s3, and schools A, B s1: B>A s2: A s3: A>B A: s1>s2>s3 B: s3>s1 Schools have one slot Student-proposing DA => (s1,A), s2, (s3,B) But every student prefers: (s1,B), s2, (s3,A) Reform of Boston Program Abdulkadiroglu et al. (2008) describe the reform of the Boston school match. They proposed either student-proposing DA or TTC; the school system chose DA in 2006. They didn’t like the idea of “trading priorities”. Reform of NYC Program Abdulkadiroglu et al. (2009) describe reform of the NYC school choice program. Recall NYC has a really big system: 90,000 students enter high schools each year! Unlike in Boston, schools do not have fixed priorities, but can be strategic (and frequently were strategic under the old system). NYC decided to adopt student-proposing DA. More on NYC NYC now uses student-proposing DA, except Students can rank only 12 schools A few schools (Stuyvesant, Bronx Science) get filled first using examinations. Some top students automatically get first choice. Unmatched students go to a second round, which uses random serial dictatorship. In first year of new program More than 70,000 got one of their choice schools. Another 7,600 got a choice school in RSD stage Just 3,000 were left, down from 30,000. Summary on School Choice School choice is a new application of matching theory. Stability is a fairness criterion: no justified envy. Student-proposing DA makes sense if stability is important. TTC generates efficiency gains if stability is not necessary. NYC, Boston and other cities have switched to new mechanisms, mainly DA.