Matching with matchit with flexible exact argument

80 views Asked by At

I have some simple data of housing sales, divided into a control and a treatment group. I would like to get a matched control group that is similar to the treatment group on some characteristics (size of the house, age, number of rooms) using the matchit package. Besides, I would like to have constraining matching on the district and on a temporal variable like the year of sale. The code would look like the following:

  m.out1 <- matchit(
  treatment ~ house_size + age + number_of_rooms,
  exact = ~district + year_of_sale,
  data = housing_data,
  method = "nearest",
  distance = "mahalanobis"
)

The year of sale has a major disadvantage: a control sale on 12/31/2015 would not be matched to a treatment sale on 01/01/2016, because the year of sale is not identical, even though the two sales were carried out on subsequent sales.

This if why I would like to create a temporal distance matrix where I calculate for each sale the difference in days to all the other sales. This matrix would let me know that between the two illustrated sales, there is only one day of difference. Then I would like to include this temporal distance matrix in the matchit function and state as a condition: the control sales must not be further apart than 365 days from a treatment sale, otherwise it mustn't be match. The idea would be very similar to the exact argument, but with more flexibility.

My question is whether something like this is implementable in the matchit package and if yes, how? Or maybe in another R package for matching?

0

There are 0 answers