I have a set of data, with outcome and time-varying variables, for patients during the course of their respective stays in the hospital. There is a dichotomous outcome on the last day. The length of stay may be different for each patient. I am most interested in making a predictive model, in the same spirit as one might do with standard regression.

I believe that the patient may develop some "momentum" which would tend lead to one outcome or the other.

My previous attempts to model this data have been limited to logistic regression. I am beginning to think about lmer and friends, but I'm not sure if it would be suitable for the directionality in time. Also, I have considered some stochastic approaches, but I haven't made much progress with hitching this into a binary outcome or even considering the covariates.

Any suggestions would be most welcomed.

Fictional Data:

Patient No. | Day of Stay | Outcome | Age | Gender | Blood Value | ...
         1  |           1 |       - |  70 |      M |       123.1 | ...
         1  |           2 |       - |  70 |      M |       134.2 | ...
         1  |         ... |     ... | ... |    ... |         ... | ...
         1  |          10 |       1 |  70 |      M |       148.3 | ...
           ...           ...       ...   ...      ...           ...
       100  |           1 |       - |  54 |      F |        98.3 | ...
       100  |           2 |       - |  54 |      F |        95.2 | ...
       100  |         ... |     ... | ... |    ... |         ... | ...
       100  |           6 |       0 |  54 |      F |        54.1 | ...
  • $\begingroup$ Do you have LOTS of data? Or a fairly small number of patients? And could you specify what sort of relationship you think exists between outcome and your time-series? $\endgroup$
    – Placidia
    Dec 9, 2012 at 1:21
  • $\begingroup$ Well, both. We have a ton of retrospective data, seemingly infinite number of columns at our disposal. But I could image doing this on 100 or even a million. I'm open to all suggestions: frequentist, Bayesian, etc. It's hard to say what the relationship is, but in health care, I assume that the more one deviates from "normal" (up or down) the more unfortunate outcome is more likely to happen. $\endgroup$
    – Eric Brown
    Dec 9, 2012 at 1:36
  • 1
    $\begingroup$ This would seem amenable to survival analysis which doesn't require that the outcomes be survival only that they be dichotomous and occur at a particular time. Time varying covariates are possible. $\endgroup$
    – DWin
    Dec 5, 2013 at 3:42

2 Answers 2


If you have a LARGE data set, there might be something in the machine learning literature to help you. View it as a classification problem. But since this is a medical example, I suspect the total number of patients is fairly small.

In that case, your best hope lies in being able to specify a model for the time-dependent stuff. For example, if a simple regression relates Day to Blood Value, you could compare the estimated slope parameter to outcome: 2 groups; simple t-test. If you have additional covariates, you could include them as well. You would then have a logistic regression with your slope parameter and covariates in the model. You could fit a more complex functional form if needed.

You might be able to model the blood value component in other ways: try a principal components analysis, and if most of the variation appear to be on the first component, replace the whole series of observations with the PC score. Then proceed as before with a logistic regression.

If you had the same number of "repeated observations" for each patient, you could try a discriminant analysis. This is similar to the PCA mentioned above, except that the components are chosen to best distinguish between the two dichotomous outcome of the last day.

Whatever you do, you can estimate your model from one portion of the data set and test it on the other part -- see how well you can actually predict the outcome.


I think a mixed effects model or a marginal model using generalized estimating equations (GEE) might work for you. Using GEE you could specify a working correlation matrix that designates those observations later in the series as being more highly correlated with one another and you could add a variable into your model for the time component. You could, of course do something similar with lmer and mixed effects (minus the working correlation matrix bit). The mixed effects approach has the added benefit that it isn't using a population averaged approach like GEE.

Taking this a step further, you may even be able to build several predictive models using classical statistical modelling techniques and machine learning techniques like boosted regression trees and then use a machine learning ensemble method to combine them into a single, more powerful predictor. Using Stacking for example, you might build several models and then combined all of the models into one final prediction model. These models generally outperform Bayesian model averaging approaches as well.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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