I am trying to model the effect of one or more discrete interventions (e.g., taking a pill, attending therapy) on a continuous outcome (e.g., pain level of a patient over time). The features are discrete binary events in time series. Here's an example of how the data might look:

timestamp  took_pill  attended_phys_therapy  pain_level 
1                                            4.1
2           true                             4.0
3                                            4.2
4                                            3.1
5                     true                   2.8
6                                            2.6
7                                            2.3
8                                            2.4

In this simple example, I'm trying to capture the fact that the interventions (the subject took a pill) at time t=2 led to a change in pain at time t={4..6}.

Here are some options I am considering:

  1. Apply a decay function (e.g., Gaussian, exponential) to the binary events to create a continuous feature (took_pill_decayed), and do time lag regression of pain_level ~ took_pill_decayed + attended_phys_therapy_decayed

  2. Aggregate both indep and dep variables to longer time windows that would capture both the event and the outcome (say, 6-hour windows). Make a "sliding window" for each time step.

A few additional notes/assumptions:

  1. The effects of the interventions are non-permanent. I've looked into ITS (interrupted time series analysis) and paired t-test analyses . However, these seem to be tailored towards semi-permanent interventions such as economic policy changes.

  2. Ideally, I would also like to understand how long after an intervention the outcome was influenced, not just whether it influenced it.

Would love any suggestions!


What you are looking for is the de facto period as compared to the de jure period of the interevention. This can be accomplished via Intervention Detection procedures which covers both pulse effects (your case) and permanent effects (intercept changes) . One needs to simultaneously incorporate (adjust for) auto-regressive structure. http://docplayer.net/12080848-Outliers-level-shifts-and-variance-changes-in-time-series.html and elsewhere pursues the detection of the true time period of the event. If the true period is not equal to the known period then we have the answer to your "how long" question.

If you wish to post a complete data set I will try to help further. The data of course must be fixed interval readings.

  • $\begingroup$ Thank you kindly, I'll read the paper. To complicate things further, the data collection is not fixed-interval (the intervention and response could be self-reported at any time of day), however my assumption was that I would have to transform it to become fixed-interval. It will end up being quite sparse, so I'll probably need to do a lot of imputation. I'm planning to post separately for advice on dealing with sparse / non-fixed-interval time series data. $\endgroup$ – djbnyc Apr 9 '18 at 20:53
  • $\begingroup$ stats.stackexchange.com/questions/338978/… discusses a similar problem and my suggestion regarding a possible remedy. $\endgroup$ – IrishStat Apr 9 '18 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.