insongkim / PanelMatch

118 stars 36 forks source link

Code for checking covariate balance before matching? #94

Closed zhaoliresearch closed 2 years ago

zhaoliresearch commented 2 years ago

Hello,

Could you please explain how one could calculate covariate balance before matching using the get_covariate_balance() function? For example example, what code would replicate the left most pane (labeled "Before Matching") of Figures D.6 and D.7 in the online appendix for Imai, Kim, and Wang (AJPS 2021)?

I understand that this issue has been raised before, but based on the answer there I'm still not sure how to construct the appropriate matched.set object in pre-matching data. Could you please share example code based on, say, the Acemoglu et al. (2018) replication data in the PanelMatch package?

Thank you very much!

insongkim commented 2 years ago

Thanks for the question @zhaoliresearch . The replication code is available here: https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/ZTDHVE

As we noted earlier here, I would run PanelMatch with refinement.method = none, and then use the get_covariate_balance function to the compute the balance. Alternatively, you can look at the matched set and manually compute the balance between the treated and the control units as described in equation (20) of the paper. Thank you very much!

zhaoliresearch commented 2 years ago

Thank you, @insongkim! I see that I need to set matching=FALSE in PanelMatch() first, and then use refinement.method='none' in get_covariate_balance(). My bad for missing this important detail.

insongkim commented 2 years ago

Yes, exactly. Thank you very much @zhaoliresearch