Advantages of panel data, i.e., difference in difference (DID) design data, are a large sample size and easy availability. Therefore, panel data are widely used in epidemiology and in all social science fields. The literatures on causal inferences of panel data setting or DID design are growing, but no theory or mediation analysis method has been proposed for such settings. In this study, we propose a methodology for conducting causal mediation analysis in DID design and panel data setting. We provide formal counterfactual definitions for controlled direct effect and natural direct and indirect effect in panel data setting and DID design, including the identification and required assumptions. We also demonstrate that, under the assumptions of linearity and additivity, controlled direct effects can be estimated by contrasting marginal and conditional DID estimators whereas natural indirect effects can be estimated by calculating the product of the exposure-mediator DID estimator and the mediator-outcome DID estimator. A panel regression-based approach is also proposed. The proposed method is then used to investigate mechanisms of the effects of the Covid 19 pandemic on the mental health status of the population. The results revealed that mobility restrictions mediated approximately 45 % of the causal effect of Covid 19 on mental health status.
Hsia, Pei-Hsuan; Tai, An-Shun; Kao, Chu-Lan Michael; Lin, Yu-Hsuan; and Lin, Sheng-Hsuan, "Causal Mediation Analysis for Difference-in-Difference Design and Panel Data" (January 2021). Harvard University Biostatistics Working Paper Series. Working Paper 231.