Iematch

Jump to: navigation, search

iematch is used to match observations in one group to observations in another group based on a single variable. This single variable could be a p-score but could be any continuous variable.

This article is means to describe use cases, work flow and the reasoning used when developing the commands. For instructions on how to use the command specifically in Stata and for a complete list of the options available, see the help files by typing help iematch in Stata. This command is a part of the package ietoolkit, to install all the commands in this package including this command, type ssc install ietoolkit in Stata.

Intended use cases

Important Disclaimer: There is no test in iematch that confirms the validity of a match from an economic theory aspect. This command only performs the computational task of matching one set of observations to observations in another set. You must perform the tests that you find appropriate to your case. Our understanding is that there is no consensus on a general test for this, but if you have suggestions for tests that we should implement and return statistics on, please let us know. Contact information on our GitHub page

A very common use case for matching in impact evaluations is propensity score matching (PSM). There are several user written commands developed specifically for propensity score matching that includes all steps required and in most cases you want to use one of those commands for PSM analysis. However, sometimes your PSM analysis might require a special step that none of the off-the-shelf PSM commands offer, and you will have to set up each step of the PSM analysis yourself. In such a case iematch can do the matching step for you.

iematch can also be used to sample controls to treatment observations using baseline data. This is sometimes done when the controls to the treatment observation was not selected at the time of random treatment assignment and needs to be identified in a larger population. There are many factors that can make this type of pairing invalid despite the matching result provided by iematch being mathematically correct. You always need to use econometrical reasoning for the validity of this technique in your case given the data you have available.

Instructions

These instructions are meant to help you understand how to use the command. For technical instructions on how to implement the command in Stata see the help files by typing help iematch in Stata.

Replicable results

If all values in the variable used for the matching are unique, then the results will always be the same no matter sort order of the data set as long as the values does not change. However, it is not as straightforward if several observations have the same value in the matching variable. The matching algorithm used by iematch must have a unique sort order so a random variable is generated to guarantee this. This random variable has no effect on observations with unique values in the matching variable, so if all values are unique there is no need to take this into consideration.

However, if there are duplicates in the matching varaible then the random variable will decide which observation that will be matched first. For balance purposes it should make no difference which observation with identical that is matched first, but for replicablility this matters. Therefore, iematch throws and error if it detects duplicates in the matching variable, unless the solution described in next paragraph is used.

The solution to getting this duplicate values is to set a seed before you run iematch and then use the option seedok. After setting a seed the random values assigned will be the same each time which will generate the same result each time iematch is used, even if some observations have duplicate values. The option seedok can be used to suppress the error matching without setting the seed if replicable results does not matter or if you want a new random selection each time you use iematch, but in most cases in impact evaluations, this is probably not the best way to do it.

One-to-One and Many-to-One

Reasoning used during development

iematch does not identify globally optimal matching results as it uses greedy matching. In optimal matching the sum of all absolute differences between matched pairs is minimized using optimization. In greedy matching the sum of differences is not regarded, the matching starts by matching the best pair, then the second best pair etc. until all valid pairs are found. An optimal match might split up a very good match and a decent match to create two medium good matches. Optimal matches are much more complex and require more computational power, and it often the results are only marginally better and does not seem to make a difference to overall balance (Gu and Rosenbaum 1993).

Back to Parent

This article is part of the topic ietoolkit

References

  • Gu S, Rosenbaum PR. Comparison of multivariate matching methods: structure, distances, and algorithms. J Comput Graph Stat 1993;2:405–20.