Causal inference and longitudinal data: a case study of religion and mental health



We provide an introduction to causal inference with longitudinal data and discuss the complexities of analysis and interpretation when exposures can vary over time.


We consider what types of causal questions can be addressed with the standard regression-based analyses and what types of covariate control and control for the prior values of outcome and exposure must be made to reason about causal effects. We also consider newer classes of causal models, including marginal structural models, that can assess questions of the joint effects of time-varying exposures and can take into account feedback between the exposure and outcome over time. Such feedback renders cross-sectional data ineffective for drawing inferences about causation.


The challenges are illustrated by analyses concerning potential effects of religious service attendance on depression, in which there may in fact be effects in both directions with service attendance preventing the subsequent depression, but depression itself leading to lower levels of the subsequent religious service attendance.


Longitudinal designs, with careful control for prior exposures, outcomes, and confounders, and suitable methodology, will strengthen research on mental health, religion and health, and in the biomedical and social sciences generally.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3


  1. 1.

    Robins JM (1986) A new approach to causal inference in mortality studies with sustained exposure period—application to control of the healthy worker survivor effect. Math Model 7:1393–1512

    Article  Google Scholar 

  2. 2.

    Pearl J (2009) Causality: models, reasoning, and inference, 2nd edn. Cambridge University Press, Cambridge

    Google Scholar 

  3. 3.

    Robins JM (1999) Association, causation, and marginal structural models. Synthese 121:151–179

    Article  Google Scholar 

  4. 4.

    Robins JM, Hernán MA, Brumback B (2000) Marginal structural models and causal inference in epidemiology. Epidemiology 11:550–560

    CAS  Article  PubMed  Google Scholar 

  5. 5.

    Robins JM, Hernán MA (2009) In: Fitzmaurice G, Davidian M, Verbeke G, Molenberghs G (eds) Estimation of the causal effects of time-varying exposures. Chapman and Hall, New York

    Google Scholar 

  6. 6.

    Koenig HG, King DE, Carson VB (2012) Handbook of religion and health, 2nd edn. Oxford University Press, Oxford

    Google Scholar 

  7. 7.

    Maselko J, Hayward RD, Hanlon A, Buka S, Meador K (2012) Religious service attendance and major depression: a case of reverse causality? Am J Epidemiol 175(6):576–583

    Article  PubMed  PubMed Central  Google Scholar 

  8. 8.

    VanderWeele TJ (2013) Re: “Religious service attendance and major depression: a case of reverse causality?”. Am J Epidemiol 177(3):275–276

    Article  PubMed  Google Scholar 

  9. 9.

    Li S, Okereke OI, Chang S-C, Kawachi I, VanderWeele TJ (2016) Religious service attendance and lower depression among women - a prospective cohort study. Ann Behav Med. doi:10.1007/s12160-016-9813-9

    Google Scholar 

  10. 10.

    Koegh R, Daniels R, VanderWeele TJ, Vansteelandt S Analysis of longitudinal studies: adjusting for time-dependent confounding using conventional methods. Am J Epidemiol

  11. 11.

    Hernán MA, Robins JM (2016) Causal inference. Chapman Hall, New York

    Google Scholar 

  12. 12.

    Shrier I, Platt RW (2008) Reducing bias through directed acyclic graphs. BMC Med Res Methodol 8(1):1

    Article  Google Scholar 

  13. 13.

    Glymour MM, Weuve J, Berkman LF, Kawachi I, Robins JM (2005) When is baseline adjustment useful in analyses of change? An example with education and cognitive change. Am J Epidemiol 162(3):267–278

    Article  PubMed  Google Scholar 

  14. 14.

    Danaei G, Tavakkoli M, Hernán MA (2012) Bias in observational studies of prevalent users: lessons for comparative effectiveness research from a meta-analysis of statins. Am J Epidemiol 175(4):250–262

    Article  PubMed  PubMed Central  Google Scholar 

  15. 15.

    Hernán MA (2015) Epidemiology to guide decision-making: moving away from practice-free research. Am J Epidemiol 182(10):834–839

    Article  PubMed  PubMed Central  Google Scholar 

  16. 16.

    Rosenbaum PR (2002) Observational studies. Springer, New York

    Google Scholar 

  17. 17.

    Rothman KJ, Greenland S, Lash TL (2008) Modern epidemiology, 3rd edn. Lippincott Williams and Wilkins, Philadelphia

    Google Scholar 

  18. 18.

    Ding P, VanderWeele TJ (2016) Sensitivity analysis without assumptions. Epidemiology 27(3):368–377

    Article  PubMed  PubMed Central  Google Scholar 

  19. 19.

    Morgan SL, Winship C (2014) Counterfactuals and causal inference, 2nd edn. Cambridge University Press, Cambridge

    Google Scholar 

  20. 20.

    Imbens G, Rubin DB (2015) Causal inference in statistics, social, and biomedical sciences: an introduction. Cambridge University Press, New York (in press)

    Google Scholar 

  21. 21.

    VanderWeele TJ (2016) Explanation in causal inference: methods for mediation and interaction. Oxford University Press, New York

    Google Scholar 

  22. 22.

    Horvitz DG, Thompson DJ (1952) A generalization of sampling without replacement from a finite universe. J Am Stast Assoc 47:663–685

    Article  Google Scholar 

  23. 23.

    Rosenbaum PR, Rubin DB (1983) The central role of the propensity score in observational studies for causal effects. Biometrika 70:41–55

    Article  Google Scholar 

  24. 24.

    Jackson JW (2016) Diagnostics for confounding of time-varying and other joint exposures. Epidemiology. doi:10.1097/EDE.0000000000000547

  25. 25.

    Cole SR, Hernán MA (2008) Constructing inverse probability weights for marginal structural models. Am J Epidemiol 168:656–664

    Article  PubMed  PubMed Central  Google Scholar 

  26. 26.

    Hernán MA, Brumback B, Robins JM (2002) Estimating the causal effect of zidovudine on CD4 count with a marginal structural model for repeated measures. Stat Med 21:1689–1709

    Article  PubMed  Google Scholar 

  27. 27.

    Hernán MA, Brumback B, Robins JM (2000) Marginal structural models to estimate the causal effect of zidovudine on the survival of HIV-positive men. Epidemiology 11:561–570

    Article  PubMed  Google Scholar 

  28. 28.

    Robins JM (1999) Marginal structural models versus structural nested models as tools for causal inference. In: Halloran ME, Berry D (eds) Statistical models in epidemiology: the environment and clinical trials. Springer, NY, pp 95–134

    Google Scholar 

  29. 29.

    VanderWeele TJ (2012) Structural equation modeling in epidemiologic analysis. Am J Epidemiol 176:608–612

    Article  PubMed  PubMed Central  Google Scholar 

  30. 30.

    VanderWeele TJ, Hawkley LC, Cacioppo JT (2012) On the reciprocal relationship between loneliness and subjective well-being. Am J Epidemiol 176:777–784

    Article  PubMed  PubMed Central  Google Scholar 

  31. 31.

    Barber JS, Murphy SA, Verbitsky N (2004) Adjusting for time-varying confounding in survival analysis. Sociol Methodol 34:163–192

    Article  Google Scholar 

  32. 32.

    Bray BC, Almirall D, Zimmerman RS, Lynam D, Murphy SA (2006) Assessing the total effect of time-varying predictors in prevention research. Prev Sci 7:1–17

    Article  PubMed  PubMed Central  Google Scholar 

  33. 33.

    Vansteelandt S, Sjolander A (2016) Revisiting g-estimation of the effect of a time-varying exposure subject to time-varying confounding. Epidemiol Methods. doi:10.1515/em-2015-0005

  34. 34.

    Vansteelandt S (2009) Estimating direct effects in cohort and case-control studies. Epidemiology 20:851–860

    Article  PubMed  Google Scholar 

  35. 35.

    Strawbridge WJ, Shema SJ, Cohen RD, Kaplan GA (2001) Religious attendance increases survival by improving and maintaining good health behaviors, mental health, and social relationships. Ann Behav Med 23(1):68–74

    CAS  Article  PubMed  Google Scholar 

  36. 36.

    Van Voorhees BW, Paunesku D, Kuwabara SA et al (2008) Protective and vulnerability factors predicting new-onset depressive episode in a representative of US adolescents. J Adolesc Health 42(6):605–616

    Article  PubMed  Google Scholar 

  37. 37.

    Norton MC, Singh A, Skoog I et al (2008) Church attendance and new episodes of major depression in a community study of older adults: the Cache County Study. J Gerontol B Psychol Sci Soc Sci 63(3):P129–P137

    Article  PubMed  PubMed Central  Google Scholar 

  38. 38.

    Balbuena L, Baetz M, Bowen R (2013) Religious attendance, spirituality, and major depression in Canada: a 14-year follow-up study. Can J Psychiatry 58:225–232

    PubMed  Google Scholar 

  39. 39.

    Li S, Stamfer M, Williams DR, VanderWeele TJ (2016) Association between religious service attendance and mortality among women. JAMA Intern Med 176(6):777–785

    Article  PubMed  Google Scholar 

  40. 40.

    Schnall E, Wassertheil-Smoller S, Swencionis C et al (2010) The relationship between religion and cardiovascular outcomes and all-cause mortality in the Women’s Health Initiative Observational Study. Psychol Health 25(2):249–263

    Article  PubMed  Google Scholar 

  41. 41.

    Lim C, Putnam RD (2010) Religion, social networks, and life satisfaction. Am Sociol Rev 75:914–933

    Article  Google Scholar 

  42. 42.

    Moerkerke B, Loeys T, Vansteelandt S (2015) Structural equation modeling versus marginal structural modeling for assessing mediation in the presence of posttreatment confounding. Psychol Methods 20(2):204

    Article  PubMed  Google Scholar 

  43. 43.

    Marshall B, Galea S (2015) Formalizing the role of agent-based modelling in causal inference and epidemiology. Am J Epidemiol 181(2):92–99

    Article  PubMed  Google Scholar 

Download references


Tyler J. VanderWeele and Shanshan Li were funded by the Templeton Foundation. John Jackson was funded by the Alonzo Smythe Yerby Fellowship.

Author information



Corresponding author

Correspondence to Tyler J. VanderWeele.

Ethics declarations

Conflict of interest

The authors have no conflicts of interest to report.

Electronic supplementary material

Below is the link to the electronic supplementary material.

Supplementary material 1 (PDF 293 kb)

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

VanderWeele, T.J., Jackson, J.W. & Li, S. Causal inference and longitudinal data: a case study of religion and mental health. Soc Psychiatry Psychiatr Epidemiol 51, 1457–1466 (2016).

Download citation


  • Causal inference
  • Longitudinal data
  • Marginal structural models
  • Confounding
  • Religion