kosukeimai / MatchIt

R package MatchIt
205 stars 43 forks source link

PSM-DiD on Panel data/match or Unmatch for control with multiple group of treatment #170

Closed iammuhammad41 closed 1 year ago

iammuhammad41 commented 1 year ago

I want to implement the PSM-DiD (Propensity Score Matching Difference-in-Differences) method in Python/R/SAS/STATA. While my dataset consists of 10 columns: period, fs, fa, pt, hl, offce, oce, ppg, area, and hpv.

Dependent Variable: 'hpv' (discrete values) Independent Variables: 'fa', 'fs'. The controlled group is identified by values where fs=0 and fa=0. While treatment group is identified by values where fs>0 and fa>0 Moderator Variables: ['hl', 'pt'] (both binary values) Covariates: ['oce', 'area', 'offce', 'ppg'] 'ppg' is a discrete-valued covariate. 'oce' is a binary-valued covariate. 'offce' is a binary-valued covariate. The ‘period’ column has different periods spanning almost 15 days. The data was collected on a daily basis, including new doctors who joined the healthcare service provider platform during the periods.

So finally I want to perform the PSM-DiD method on this dataset to analyze the impact of various factors on doctors' engagement and services provided.

How can I deal these 4 varibales (dependent, independent, moderator and covariates) to the models and to draw and generate the graphs and necessary tables.

iammuhammad41 commented 1 year ago

https://github.com/konosp/propensity-score-matching/blob/main/propensity_score_matching_v2.ipynb I've found the github repository but was unable to implement according to my dataset.

ngreifer commented 1 year ago

MatchIt does matching at a single time point. This is not the right place to ask how to implement a complex estimator that MatchIt does not support. Maybe ask on CrossValidated or StackOverflow. The MatchIt issues page is for bug reports and questions about using MatchIt. It sounds like the R package PanelMatch might be closer to what you are looking for.

iammuhammad41 commented 1 year ago

@ngreifer thank you so much for the response and suggession. I will ask there.