Skip to main content
1 of 3
Eric Czech
  • 830
  • 8
  • 15

Basic modeling question with timeseries as covariate

I have a dataset with a bunch of entities (patients) and for each of these entities I have:

  1. A binary outcome specific to each entity (ie outcome does not vary in time)
  2. Some static predictors specific to each entity (e.g. gender, age)
  3. A single, time-varying measurement taken hourly for each entity, over some number of hours that is not necessarily the same for each (ie the timeseries for this measurement have different lengths)

I also suspect that the time-varying measurement has an effect on the outcome only when below a certain level. In other words, doing something as simple as just taking the mean measurement over all time points does not accomplish what I want.

What I would like to do would be to have a "change point" in the time-based measurement below which it's effect on the outcome can differ from its effect above that point, or in other words, I want two coefficients for that one predictor. I'm familiar with basic change point models but what I don't understand here is how I should literally structure my training data.

I don't want to do this, because it repeats the static covariates for each measurement:

Entity  Hour Gender  Age  Measurement  Outcome
1       1    Male    42   3.3          1
1       2    Male    42   8.9          1
1       3    Male    42   1.1          1
...
2       1    Female  33   2.3          0
2       2    Female  33   5.9          0

What other choices do I have then? What I'd really like is just one observation per entity but I'm not sure how to summarise the timeseries values into a single value for each when I also want the change point to be part of the estimation.

Does anybody have ideas on how to model something like this? Confidence or credible intervals on both the change points and coefficients are a must (and suggestions within the realm of R or python would be much appreciated).

Thanks!


P.S. Also, any recommendations on how to better understand the effects of repeated covariates on estimation would be a huge help too. I know that having repeated covariates mixed with non-repeated covariates is a bad thing, but maybe there are ways to adjust for the differences in true sample sizes? Mixed-effects regression would be great if it was applicable here, but I don't see how it is if the outcome does not also vary in time with each hourly measurement.

Eric Czech
  • 830
  • 8
  • 15