# Count data time series for hospital emergency arrivals

i recently started to work in a hospital and we are interested in forecasting the arrivals to emergency; the only variable we have information about is the number of arrivals to emergency

The time series looks like this

And the acf and pacf look like this

I've been having trouble with fitting a time series model to this data, i'd tried an ARMA model with an autoregressive component of order 7 and an moving average component of the same order as well; nonetheless the time series seem pretty random and by the autocorrelation plot and partial autocorrelation plot, the autocorrelation looks very low so, there's no sense in fitting such a model in my opinion (correct me if i'm wrong); i tried fitting an Poisson Autoregressive model, but the results were quite similar, and the forecast were pretty poor. To this point i'm kinda lost and don't know any other ideas in order to get a good fit and a good forecast for this data, it will be helpful an advice on how to approach this problem. Thank you in advance.

• You need to add time of the day, day of the week, special holidays, month of the year and other pertinent variables because they are all shown to be effective in predicting emergency department visits. You can generate most of the variables automatically. You can also add weather related information if you have it. Jul 6, 2018 at 3:52
• @forecaster I have worked with Paris transportation hourly data by day and have found that hourly patterns often depend on day-of-the-week etc.. A true challenge for software ( and humans ) to sort this out. Jul 6, 2018 at 20:32
• I finally used a GAM model as exposed in stats.stackexchange.com/questions/173/…. Thank you everyone.
– user161805
Jul 9, 2018 at 16:50

You don't say so, but I assume your data are daily. And that you only have one year's worth of data.

Your ACF/PACF plots show spikes at lag 7, 14 etc. This is weekly seasonality, which makes sense for emergency admissions. Thus, you should tell R that you have a seasonal time series with period 7, ts(..., frequency=7). Then auto.arima() should pick up on your seasonality and give you a seasonal ARIMA model. This should be the benchmark you should evaluate more complex models against.

An alternative simple benchmark would be a "seasonal naive" forecast: for next Sunday, forecast last Sunday's observation, and so on. Simple benchmarks can be very hard to beat.

If you get more than a year's worth of data, you could try also including yearly seasonality using models that can deal with , e.g., or .

In addition, think about any strong drivers. What makes people come to your emergency department? Is it weather? (This may be more important in some parts of the world than in others.) Is it special days, like people hurting themselves with fireworks in the US on July 4th or elsewhere on New Year's Eve (these might be covered by yearly seasonality)? Has there been a change in regulation that induced a step change somewhere? Use a regression approach to include such drivers, then model residuals using time series algorithms as a above.

We have a number of questions on daily , so browsing through them might be helpful.

In a larger sense ..daily data is often driven by exogenous factors ...such as day-of-the-week , day-of-the-month , week-of-the-month , month-of-the year , activity before on and after major holidays , long-weekend effects around holidays , level shifts / local time trends and often overlooked changes in day-of-the-week effects.

To identify factors listed above one needs to detect unusual one-time effects that need to be included so that one can more clearly identify. Untreated outliers obfuscate statistical structure.

On top of all of this is the need to incorporate any arima structure reflecting omitted/unspecified stochastic input series such as weather today, weather yesterday and anticipated weather for the next day. Arima structure should be used as a last resort as it naively premises that the past is the cause/reason for the future .. much like driving down the road using the rear window to guide you thus imposing endogeneity rather than exogeneity (causal series).

Known or guessed causal variables such as price , weather , population counts acre also critical as their inclusion often unmasks/clarifies other significant dependencies.

With only 1 year of data you will be challenged to distinguish anomalies from real effects.

One starts this process by searching for the umbrella effect of holidays and simultaneously identifying level shifts and/or local time trends while incorporating day-of-the-week variables. Now settle back and iteratively examine model residuals in order to suggest model augmentation (step-forward) while also excluding factors that are non-significant (step-down ).

I have personally used this approach for a number of similar series like yours with great success.

For list of daily data analyses/reflections take a look at https://stats.stackexchange.com/search?q=user%3A3382+daily