CC BY-NC-ND 4.0 · Methods Inf Med 2018; 57(S 01): e10-e21
DOI: 10.3414/ME16-02-0044
Focus Theme – Original Articles
Schattauer GmbH

Causal Analysis of Self-tracked Time Series Data Using a Counterfactual Framework for N-of-1 Trials*

Eric J. Daza
1   Stanford Prevention Research Center, Stanford University School of Medicine, Stanford, CA, USA
› Author Affiliations
This work was supported by the National Institutes of Health (NIH) grant 2T32HL007034-41. The content is solely the responsibility of the author and does not necessarily represent the official views of the NIH.
Further Information

Publication History

received: 20 November 2016

accepted: 16 August 2017

Publication Date:
05 April 2018 (online)


Background: Many of an individual’s historically recorded personal measurements vary over time, thereby forming a time series (e.g., wearable-device data, self-tracked fitness or nutrition measurements, regularly monitored clinical events or chronic conditions). Statistical analyses of such n-of-1 (i.e., single-subject) observational studies (N1OSs) can be used to discover possible cause-effect relationships to then self-test in an n-of-1 randomized trial (N1RT). However, a principled way of determining how and when to interpret an N1OS association as a causal effect (e.g., as if randomization had occurred) is needed.

Objectives: Our goal in this paper is to help bridge the methodological gap between risk-factor discovery and N1RT testing by introducing a basic counterfactual framework for N1OS design and personalized causal analysis.

Methods and Results: We introduce and characterize what we call the average period treatment effect (APTE), i.e., the estimand of interest in an N1RT, and build an analytical framework around it that can accommodate autocorrelation and time trends in the outcome, effect carryover from previous treatment periods, and slow onset or decay of the effect. The APTE is loosely defined as a contrast (e.g., difference, ratio) of averages of potential outcomes the individual can theoretically experience under different treatment levels during a given treatment period. To illustrate the utility of our framework for APTE discovery and estimation, two common causal inference methods are specified within the N1OS context. We then apply the framework and methods to search for estimable and interpretable APTEs using six years of the author’s self-tracked weight and exercise data, and report both the preliminary findings and the challenges we faced in conducting N1OS causal discovery.

Conclusions: Causal analysis of an individual’s time series data can be facilitated by an N1RT counterfactual framework. However, for inference to be valid, the veracity of certain key assumptions must be assessed critically, and the hypothesized causal models must be interpretable and meaningful.

  • References

  • 1 Ponterotto JG. Qualitative research in counseling psychology: A primer on research paradigms and philosophy of science. Journal of Counseling Psychology 2005; 52 (02) 126-136.
  • 2 Guyatt G, Sackett D, Taylor DW, Ghong J, Roberts R, Pugsley S. Determining optimal therapy – randomized trials in individual patients. New England Journal of Medicine 1986; 314 (14) 889-892.
  • 3 Guyatt GH, Keller JL, Jaeschke R, Rosenbloom D, Adachi JD, Newhouse MT. The n-of-1 randomized controlled trial: Clinical usefulness: Our three-year experience. Annals of Internal Medicine 1990; 112 (04) 293-299.
  • 4 Backman CL, Harris SR. Case studies, single-subject research, and n of 1 randomized trials: Comparisons and contrasts. American Journal of Physical Medicine & Rehabilitation 1999; 78 (02) 170-176.
  • 5 Gabler NB, Duan N, Vohra S, Kravitz RL. N-of-1 trials in the medical literature: A systematic review. Medical Care 2011; 49 (08) 761-768.
  • 6 Lillie EO, Patay B, Diamant J, Issell B, Topol EJ, Schork NJ. The n-of-1 clinical trial: The ultimate strategy for individualizing medicine?. Personalized Medicine 2011; 08 (02) 161-173.
  • 7 Duan N, Kravitz RL, Schmid CH. Single-patient (n-of-1) trials: A pragmatic clinical decision methodology for patient-centered comparative effectiveness research. Journal of Clinical Epidemiology 2013; 66 (08) S21-S28.
  • 8 Naughton F, Johnston D. A starter kit for undertaking n-of-1 trials. European Health Psychologist 2014; 16 (05) 196-205.
  • 9 Nikles J, Mitchell G. The Essential Guide to N-of-1 Trials in Health. Springer; 2015
  • 10 Shamseer L, Sampson M, Bukutu C, Schmid CH, Nikles J, Tate R. et al. CONSORT extension for reporting N-of-1 trials (CENT) 2015: Explanation and elaboration. Journal of Clinical Epidemiology 2016; 76: 18-46.
  • 11 Vohra S, Shamseer L, Sampson M, Bukutu C, Schmid CH, Tate R. et al. CONSORT extension for reporting N-of-1 trials (CENT) 2015 Statement. Journal of Clinical Epidemiology 2016; 76: 9-17.
  • 12 Kravitz R, Duan N. the DEcIDE Methods Center N-of 1 Guidance Panel. Duan N, Eslick I, Gabler N, Kaplan H. et al. Design and Implementation of N-of-1 Trials: A User’s Guide. AHRQ Publication No. 13(14)-EHC122-EF. Rockville, MD: Agency for Healthcare Research and Quality; 2014
  • 13 Nikles CJ, Mitchell GK, Del Mar CB, Clavarino A, McNairn N. An n-of-1 trial service in clinical practice: Testing the effectiveness of stimulants for attention-deficit/hyperactivity disorder. Pediatrics 2006; 117 (06) 2040-2046.
  • 14 Kravitz RL, Duan N, Niedzinski EJ, Hay MC, Subramanian SK, Weisner TS. What ever happened to n-of-1 trials? Insiders’ perspectives and a look to the future. Milbank Quarterly 2008; 86 (04) 533-555.
  • 15 Chen C, Haddad D, Selsky J, Homan JE, Kravitz RL, Estrin DE. et al. Making sense of mobile health data: An open architecture to improve individual-and population-level health. Journal of Medical Internet Research 2012; 14 (04) e112.
  • 16 Barr C, Marois M, Sim I, Schmid CH, Wilsey B, Ward D. et al. The PREEMPT study-evaluating smartphone-assisted n-of-1 trials in patients with chronic pain: Study protocol for a randomized controlled trial. Trials. 2015 16(1).
  • 17 Schork NJ. Personalized medicine: Time for one-person trials. Nature 2015; 520 7549 609-611.
  • 18 Neyman J. On the application of probability theory to agricultural experiments. Essay on principles. Section 9. Statistical Science. 1923, tr 1990; 05 (04) 465-480. Translated and edited by D.M. Dabrowska and T.P. Speed from the Polish original, which appeared in Roczniki Nauk Rolniczych Tom X (1923) 1–51 (Annals of Agricultural Sciences).
  • 19 Rubin DB. Estimating causal effects of treatments in randomized and nonrandomized studies. Journal of Educational Psychology 1974; 66 (05) 688-701.
  • 20 Holland PW. Statistics and causal inference. Journal of the American Statistical Association 1986; 81 (396) 945-960.
  • 21 Robins JM. Marginal structural models versus structural nested models as tools for causal inference. In: Statistical Models in Epidemiology, the Environment, and Clinical Trials. Springer; 2000: 95-133.
  • 22 Robins JM, Hernan MA, Brumback B. Marginal structural models and causal inference in epidemiology. Epidemiology 2000; 11: 550-560.
  • 23 Robins JM, Hernan MA. Estimation of the causal effects of time-varying exposures. Longitudinal Data Analysis. 2009: 553-599.
  • 24 Klasnja P, Hekler EB, Shiman S, Boruvka A, Almirall D, Tewari A. et al. Microrandomized trials: An experimental design for developing just-in-time adaptive interventions. Health Psychology 2015; 34 (S): 1220-1228.
  • 25 Murphy SA. An experimental design for the development of adaptive treatment strategies. Statistics in Medicine 2005; 24 (10) 1455-1481.
  • 26 Nahum-Shani I, Hekler EB, Spruijt-Metz D. Building health behavior models to guide the development of just-in-time adaptive interventions: A pragmatic framework. Health Psychology 2015; 34 (S): 1209-1219.
  • 27 Aalen OO, Frigessi A. What can statistics contribute to a causal understanding? Scandinavian Journal of Statistics. 2007; 34 (01) 155-168.
  • 28 Aalen OO, Roysland K, Gran JM, Ledergerber B. Causality, mediation and time: A dynamic viewpoint. Journal of the Royal Statistical Society: Series A (Statistics in Society). 2012; 175 (04) 831-861.
  • 29 White H, Kennedy P, Bates LWhite. Retrospective estimation of causal effects through time. The Methodology and Practice of Econometrics: A Festschrift in Honour of David F Hendry. 2009: 59-87.
  • 30 White H, Lu X. Granger causality and dynamic structural systems. Journal of Financial Econometrics 2010; 08 (02) 193-243.
  • 31 Lu X, Su L, White H. Granger causality and structural causality in cross-section and panel data. Econometric Theory 2017; 33 (02) 263-291.
  • 32 Eichler M. Causal inference in time series analysis. Causality: Statistical Perspectives and Applications. 2012: 327-354.
  • 33 Eichler M, Didelez V. Causal reasoning in graphical time series models. arXiv preprint arXiv:12065246. 2012: 109-116.
  • 34 Eichler M. Causal inference with multiple time series: Principles and problems. Philosophical Transactions of the Royal Society of London A: Mathematical, Physical and Engineering Sciences. 2013; 371 (1997) 20110613.
  • 35 Bollen KA. Structural Equations with Latent Variables. Wiley-Interscience; 1989
  • 36 Collins JD, Hall EJ, Paul L. Causation and Counterfactuals. MIT Press; 2004
  • 37 Athey S, Imbens GW. Machine learning methods for estimating heterogeneous causal effects. arXiv:150401132v1 [statML] 5 Apr 2015. 2015: 1-24.
  • 38 Hayashi F. Econometrics. Princeton University Press; 2000
  • 39 Murphy SA. Optimal dynamic treatment regimes. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 2003; 65 (02) 331-355.
  • 40 Granger CW. Investigating causal relations by econometric models and cross-spectral methods. Econometrica: Journal of the Econometric Society 1969; 424-438.
  • 41 Granger CW. Testing for causality: A personal viewpoint. Journal of Economic Dynamics and Control 1980; 02: 329-352.
  • 42 Granger CW. Some recent development in a concept of causality. Journal of Econometrics 1988; 39 (01) 199-211.
  • 43 Rosenbaum PR. Interference between units in randomized experiments. Journal of the American Statistical Association 2007; 102 (477) 191-200.
  • 44 Pearl J. Causality. 2nd ed.. Cambridge University Press, USA; 2009
  • 45 Dawid AP. Influence diagrams for causal modelling and inference. International Statistical Review 2002; 70 (02) 161-189.
  • 46 Dawid AP, Didelez V. Identifying the consequences of dynamic treatment strategies. Research Report; 2005
  • 47 Dawid AP, Didelez V. Identifying the consequences of dynamic treatment strategies: A decision-theoretic overview. Statistics Surveys 2010; 04: 184-231.
  • 48 Robins J. A new approach to causal inference in mortality studies with a sustained exposure period – application to control of the healthy worker survivor effect. Mathematical Modelling 1986; 07 (9–12): 1393-1512.
  • 49 Pearl J, Robins J. Probabilistic evaluation of sequential plans from causal models with hidden variables. In: Proceedings of the Eleventh Conference on Uncertainty in Artificial Intelligence. Morgan Kaufmann Publishers Inc; 1995: 444-453.
  • 50 Hernan MA, Robins JM. Estimating causal effects from epidemiological data. Journal of Epidemiology and Community Health 2006; 60 (07) 578-586.
  • 51 Lunceford JK, Davidian M. Stratification and weighting via the propensity score in estimation of causal treatment effects: A comparative study. Statistics in Medicine 2004; 23 (19) 2937-2960.
  • 52 Morgan SL, Winship C. Counterfactuals and Causal Inference. Cambridge University Press; 2014
  • 53 Rosenbaum PR, Rubin DB. The central role of the propensity score in observational studies for causal effects. Biometrika 1983; 70 (01) 41-55.
  • 54 Lu Y, Zeger SL. On the equivalence of case-crossover and time series methods in environmental epidemiology. Biostatistics 2006; 08 (02) 337-344.
  • 55 Partridge SR, McGeechan K, Bauman A, Phongsavan P, Allman-Farinelli M. Improved eating behaviours mediate weight gain prevention of young adults: Moderation and mediation results of a randomised controlled trial of TXT2BFiT, mHealth program. International Journal of Behavioral Nutrition and Physical Activity 2016; 13 (01) 44.
  • 56 Trinh L, Wilson R, Williams HM, Sum AJ, Naylor PJ. Physicians promoting physical activity using pedometers and community partnerships: a real world trial. British Journal of Sports Medicine 2012; 46 (04) 284-290.
  • 57 Naimark JS, Madar Z, Shahar DR. The impact of a Web-based app (eBalance) in promoting healthy lifestyles: Randomized controlled trial. Journal of Medical Internet Research. 2015 17(3).
  • 58 Afshin A, Babalola D, Mclean M, Yu Z, Ma W, Chen CY. et al. Information technology and lifestyle: A systematic evaluation of internet and mobile interventions for improving diet, physical activity, obesity, tobacco, and alcohol use. Journal of the American Heart Association 2016; 05 (09) e003058.
  • 59 Schoeppe S, Alley S, Van Lippevelde W, Bray NA, Williams SL, Duncan MJ. et al. Efficacy of interventions that use apps to improve diet, physical activity and sedentary behaviour: A systematic review. International Journal of Behavioral Nutrition and Physical Activity 2016; 13 (01) 127.
  • 60 Killick R, Eckley I. changepoint: An R package for changepoint analysis. Journal of Statistical Software 2014; 58 (03) 1-19.
  • 61 Rubin DB. Inference and missing data. Biometrika 1976; 63 (03) 581-592.
  • 62 Little RJ, Rubin DB. Statistical Analysis with Missing Data. John Wiley & Sons; 2014
  • 63 Rothman KJ. Causes. American Journal of Epidemiology 1976; 104 (06) 587-592.
  • 64 VanderWeele TJ, Hernan MA. From counterfactuals to sufficient component causes and vice versa. European Journal of Epidemiology 2006; 21 (12) 855-858.
  • 65 VanderWeele TJ, Robins JM. Directed acyclic graphs, sufficient causes, and the properties of conditioning on a common effect. American Journal of Epidemiology 2007; 166 (09) 1096-1104.
  • 66 Spirtes P, Zhang K. Springer. Causal discovery and inference: Concepts and recent methodological advances. 2016; 03 (01) 3.
  • 67 Gelman A, Imbens G. Why ask why? Forward causal inference and reverse causal questions. National Bureau of Economic Research; 2013
  • 68 van der Laan MJ, Rose S, Gruber S. Readings in targeted maximum likelihood estimation. 2009
  • 69 Austin PC. Using ensemble-based methods for directly estimating causal effects: An investigation of tree-based G-computation. Multivariate Behavioral Research 2012; 47 (01) 115-135.
  • 70 Sekhon JS. Opiates for the matches: Matching methods for causal inference. Annual Review of Political Science 2009; 12: 487-508.
  • 71 Rubin DB. For objective causal inference, design trumps analysis. The Annals of Applied Statistics 2008; 808-840.