I have a dataset with a bunch of entities (patients) and for each of these entities I have:
- A binary outcome specific to each entity (i.e. outcome does not vary in time)
- Some static predictors specific to each entity (e.g. gender, age)
- A single, time-varying measurement taken hourly for each entity, over some number of hours that is not necessarily the same for each (i.e. the time series 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 time series 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? Would it be unheard of to try to make the change point value part of the model itself and then use information criteria or cross-validation scores to determine where the best change point is? That could give me some sense of what change point is best but I'd love to keep that estimation all in one model if possible.
Confidence or credible intervals on the coefficients are a must and having the same for the change point would be nice too, though less necessary (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.