{"id":376,"date":"2026-09-30T08:45:55","date_gmt":"2026-09-30T12:45:55","guid":{"rendered":"https:\/\/sites.bu.edu\/busharp\/?p=376"},"modified":"2026-09-29T08:26:34","modified_gmt":"2026-09-29T12:26:34","slug":"we-must-take-a-stand-against-time-travel-in-data-analysis","status":"publish","type":"post","link":"https:\/\/sites.bu.edu\/busharp\/2026\/09\/30\/we-must-take-a-stand-against-time-travel-in-data-analysis\/","title":{"rendered":"We Must Take a Stand Against Time-Travel! (in Data Analysis)"},"content":{"rendered":"<p><em>September notes from MPI Maria Glymour<\/em><\/p>\n<p><span style=\"font-weight: 400;\">For this month\u2019s BU-SHARP blog post, I want to write something warm and inviting &#8211; diving into a topic that everyone will find exciting and enjoyable.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So, I have selected the issue of time-travel in data analysis. Time-travel: until we figure out how to do this in the real world, we must be vigilant to avoid it in data analysis too!\u00a0 What do I mean by time-travel?\u00a0 I mean using information about one time point to inform the classification of a variable at an earlier time point. For example, my medication use next year does not change my medication use this year (although the reverse might be true).\u00a0 Likewise, when analyzing data, I shouldn\u2019t use information on a person\u2019s medication use in say the year 2020 to categorize that person\u2019s medication use in 2019 or before.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">When I describe it like that you may say \u201cof course not!\u00a0 Who would ever do that?\u201d\u00a0 But, I fear that this approach, or various flavors of it, is very common in research. It is especially pervasive in aging and lifecourse research, where we are typically interested in characterizing exposure over a long-period of time.\u00a0 The intuition that leads to this mistake is that we want to use everything we know about a person \u2014 their entire follow-up period \u2014 to classify their exposure status.\u00a0 For example, when studying duration of drug use as a predictor of dementia onset from 2010 to 2020, we might classify someone as never using the drug, using the drug for 1-3 years, 4-7 years, or &gt;7 years.\u00a0 But if we then apply those classifications beginning in 2010, we are using the future \u2014 information from 2011-2020 \u2014\u00a0 to classify the past. Nobody who got dementia at say 3 years into follow-up (and was thus censored) will be classified as having the maximum duration of medication use. This also applies for the \u201cnever-user\u201d group: you cannot know in 2010 that someone never used the drug, so using the entire follow-up period to identify \u201cnever users\u201d and feeding that exposure category back to predict outcomes beginning in 2010 is flawed.\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" src=\"\/busharp\/files\/2026\/08\/image-1-glymour-september-post.png\" alt=\"\" width=\"512\" height=\"211\" class=\"alignnone size-full wp-image-377\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Other examples relate to extracting a trajectory of exposure over\u00a0 the follow-up period, e.g. the slope or sequence of exposures, and then using these trajectory values to predict outcomes starting from the beginning of the follow-up period. I consider these immortal time bias (some cases may just be cousins of immortal time bias) and the bias can be very large. This is not your run of the mill confounding or selection \u2014 this bias can deliver a seriously incorrect estimate. In the simple version of this, the bias is obvious, but it is shockingly seductive. This bias has some type of siren song that calls to researchers with longitudinal data. Even knowing it, I often find myself falling into some version of this mistake. Recently there is a lot of enthusiasm for \u2018target trial emulation\u2019. One of the best things about target trial emulation is that it helps avoid this type of analytic mistake- it\u2019s not a panacea for all the things that threaten causal inference in observational data analysis, but it helps innocent analysts avoid this major unforced error.\u00a0\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Fortunately, there are alternatives to time-travel!\u00a0 We can classify at baseline only \u2014 this is often pretty useful because it predicts much of the future trajectory.\u00a0 Initiating a medication is likely strongly associated with subsequent use.\u00a0 You can also separate the exposure definition period from the outcome definition period.\u00a0 For example, characterize exposure from ages 50-60 and outcome beginning at age 60.\u00a0 And finally, you can define a time-updated exposure value.\u00a0 Each of these entails some complexities (most notably, interpreting the baseline estimate, dealing with people who do not persist in the sample, and addressing time-varying confounding, respectively). But they are all viable options and avoid the major biases of time-traveling data classification.\u00a0 So before committing to your longitudinal analysis, ask yourself: am I using any information from the future to define a variable in the past? If so, please stop, step away from the time-traveling data analysis, and redefine your time-specific variables using only information that would have been known by that time.\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" src=\"\/busharp\/files\/2026\/08\/image-2-glymour-september-post.png\" alt=\"\" width=\"512\" height=\"293\" class=\"alignnone size-full wp-image-378\" \/><\/p>\n<p><span style=\"font-weight: 400;\">That is it for the September BU-SHARP blog! Comments, citations, and examples are very welcome. And let us know if there are other topics you\u2019d be interested in hearing our opinions about!\u00a0 Probably next month we\u2019ll aim for a little less geek.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Some pertinent references:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Suissa S. Immortal time bias in pharmacoepidemiology. American journal of epidemiology. 2008 Feb 15;167(4):492.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Hern\u00e1n MA, Sauer BC, Hern\u00e1ndez-D\u00edaz S, Platt R, Shrier I. Specifying a target trial prevents immortal time bias and other self-inflicted injuries in observational analyses. Journal of clinical epidemiology. 2016 Nov 1;79:70-5.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Hern\u00e1n MA. How to estimate the effect of treatment duration on survival outcomes using observational data. Bmj. 2018 Feb 1;360.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Platt RW, Hutcheon JA, Suissa S. Immortal time bias in epidemiology. Current Epidemiology Reports. 2019 Mar 15;6(1):23-7.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Fu EL, Harhay MO, Schneeweiss S, Desai RJ, Hern\u00e1n MA. Starting right: aligning eligibility and treatment assignment at time zero when emulating a target trial. bmj. 2026 Jan 12;392.<\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>September notes from MPI Maria Glymour For this month\u2019s BU-SHARP blog post, I want to write something warm and inviting &#8211; diving into a topic that everyone will find exciting and enjoyable.\u00a0 So, I have selected the issue of time-travel in data analysis. Time-travel: until we figure out how to do this in the real [&hellip;]<\/p>\n","protected":false},"author":25693,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/sites.bu.edu\/busharp\/wp-json\/wp\/v2\/posts\/376"}],"collection":[{"href":"https:\/\/sites.bu.edu\/busharp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.bu.edu\/busharp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.bu.edu\/busharp\/wp-json\/wp\/v2\/users\/25693"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.bu.edu\/busharp\/wp-json\/wp\/v2\/comments?post=376"}],"version-history":[{"count":3,"href":"https:\/\/sites.bu.edu\/busharp\/wp-json\/wp\/v2\/posts\/376\/revisions"}],"predecessor-version":[{"id":440,"href":"https:\/\/sites.bu.edu\/busharp\/wp-json\/wp\/v2\/posts\/376\/revisions\/440"}],"wp:attachment":[{"href":"https:\/\/sites.bu.edu\/busharp\/wp-json\/wp\/v2\/media?parent=376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.bu.edu\/busharp\/wp-json\/wp\/v2\/categories?post=376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.bu.edu\/busharp\/wp-json\/wp\/v2\/tags?post=376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}