Context: I have data on 100 patients showing their time of attendance at a service. They attend on a roughly daily basis between 9-5 (except weekends and occasional missed appointments). They access a community pharmacy, so can attend at any time during opening hours (0830-1800). Some patients are recorded as being discharged from the service (various reasons).

Hypothesis: Discharge from service (binary outcome) can be predicted following an increase in the variation of their attendance time.

Question: What statistical method(s) should I investigate to develop a model to test this hypothesis?

Note: I am familiar with basic inferential tests (e.g. linear + logistic regression, basic time-series) and am stretching myself by reading up on GARCH and Functional Data. I understand these can help me describe variance in each patient's time of attendance - but not clear how to apply this to determine the risk of a binary outcome.

There's an e.g. of (idealised) data on 2 patients here.

idealised data on two patients

Patient 1 (green) has roughly constant variance and is not discharged. Patient 2 (red) demonstrates increased variance in attendance time before being discharged (red cross). Thanks in advance for any pointers to direct my reading and implementation in R.

  • $\begingroup$ Attendance time is not schedules in advance? Maybe look at control charts, or anomaly detection methods ... $\endgroup$ Commented Oct 3, 2019 at 23:58
  • $\begingroup$ Thank you @kjetilbhalvorsen Attendance times aren't scheduled - these are patients attending a community pharmacy and can go at any time the store is open. Thanks for the info. J $\endgroup$ Commented Oct 4, 2019 at 5:44
  • $\begingroup$ Can you please add that information as an exit to the post? And what is the use case, automatic signalling, early warning , ..., Who will make decisions, ... $\endgroup$ Commented Oct 4, 2019 at 8:09
  • $\begingroup$ Done. Thanks for your guidance @kjetilbhalvorsen $\endgroup$ Commented Oct 4, 2019 at 10:01

1 Answer 1


I would first try these,

  1. Group patients into two categories: those who are discharged or not

  2. Test if each patient's attendance time is stationary in variance.

  3. Tune your significance level and see if your ROC curve or confusion matrix back your hypothesis.

Tests you may want to consider are: Augmented Dickey-Fuller, Priestley-Subba Rao and Zivot-Andrews Test. They are all implemented in R. (tseries::adf.test, fractal::stationarity, urca::ur.za)

Then, you may want to fit different models for each category if you hope so.

  • $\begingroup$ thanks for the info, this is very helpful. $\endgroup$ Commented Oct 5, 2019 at 12:02

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.