I'm trying to use MatchIt to create two sets of matched investment companies (treatment vs control).
I need to match the treatment companies to the control companies using only data from the 1-3 years proceeding the treatment.
For example if a company received treatment in 2009, then I would want to match it using data from 2009, 2008, 2007 (My after treatment effects dummy would hold a value from 2010 onwards in this case)
I am unsure how to add this selection into my matching code, which currently looks like this:
matchit(signatory ~ totalUSD + brownUSD + country + strategy, data = panel6, method = "full")
Should I consider using the 'after' treatments effects dummy in some way?
Any tips for how I add this in would be greatly appreciated!
There is no straightforward way to do this in
MatchIt
. You can set a caliper, which requires the control companies to be within a certain number of years from a treated company, but there isn't a way to require that control companies have a year strictly before the treated company. You can perform exact matching on year so that the treated and control companies have exactly the same year using theexact
argument.Another, slightly more involved way is to construct a distance matrix yourself and set to
Inf
any distances between units that are forbidden to match with each other. The first step would be estimating a propensity score, which you can do manually or usingmatchit()
. Then you construct a distance matrix, and for each entry in the distance matrix, decide whether to set the distance toInf
. FInaly, you can supply the distance matrix to thedistance
argument ofmatchit()
. Here's how you would do that:That should work. You can verify by looking at individual groups of matched companies using
match.data()
:You should see that within subclasses, the control units are 0-2 years below the treated units.