# Forecasting sequence data with intermittent peaks

I'm trying to forecast a sequence that looks like below: I know ARIMA, INAR, GLM, etc. but none of these works for this data. Algorithms I found for intermittent time series (ADIDA, Croston, etc.) only output a constant expected value as forecast.

After looking at Cryo's comment, I plotted the 2 graphs he mentioned.

1. heights of the peaks (I took the values >=600 as peaks):

2. time intervals between the peaks:

These graphs do seem a lot more "normal" for any model to handle. But I see no obvious trend/seasonality in either of the graphs, and their ACF and PACFs are quite small as well.

So far, I tried the GLM models (negative binomial, binomial, poisson, etc.,) which all gave me predictions of too small variance, and ARIMA (even though the data is integer) which gives me something like below (this one is the "time intervals between peaks" series):

What are some better models/ideas to try to forecast these 2 series? And what level of prediction accuracy should I expect in the end? Is it always possible to make relatively accurate forecasts for a time series? I'm a newbie in series forecasting, thanks a lot for your help...!

• Would it make more sense to break it into forecasting the time till next spike, and the amplitude of the next spike perhaps?
– Cryo
Commented Sep 28, 2023 at 20:57
• Thank you for your suggestion! I've updated the question with the results. Commented Sep 28, 2023 at 23:37

Transformed series, delay until next peak ($$\tau_i$$) and next peak height ($$h_i$$) also look better to me. If the correlation between subsequent points is low you may struggle in predicting. Are there any external variables you can bring in?

Also, can you pick up any patterns if you plot your plots in a 2d plot, with $$\tau_i$$ on horizontal axis as $$h_i$$ on vertical?

I would try to predict $$\tau_i,\,h_i$$ in a single model. Your height is integer valued, as I understood, and your delay would be strictly non-negative, might as well assume it is integer-valued too.

\begin{align} \tau_i&\sim NB\left(r^{(\tau)}_{i},\,p^{(\tau)}_{i}\right) \\ h_i&\sim NB\left(r^{(h)}_{i},\,p^{(h)}_{i}\right) \end{align}

Where NB is negative binomial.This may require some more refinement, e.g. if your variance is smaller than your mean, you may need a different distribution, or may need to write it in terms thinning operators (more like INAR).

Then you will need to map your prior data points into $$r$$ and $$p$$. Might be something like (and similar for $$h$$):

\begin{align} r^{(\tau)}_i&=\exp\left(\sum_{j=i-1-k}^{i-1}\alpha^{(r,\tau)}_j\cdot\tau_j+\sum_{j=i-1-k}^{i-1}\beta^{(r,\tau)}_j\cdot h_j\right) \\ p^{(\tau)}_i&=expit\left(\sum_{j=i-1-k}^{i-1}\alpha^{(p,\tau)}_j\cdot\tau_j+\sum_{j=i-1-k}^{i-1}\beta^{(p,\tau)}_j\cdot h_j\right) \end{align}

In the end you write down the likelihood and optimize to find $$\alpha$$-s and $$\beta$$-s (for some chosen look-back $$k$$). Clearly, a numerical solver will be necessary. I am not sure whether any package already does this, perhaps some packages aimed at modelling integer-valued sequences do. In my recent experience optax works well for these optimization tasks, but it is very much a general purpose optimizer, so some handy-work will be required

• Thanks for the NB model suggestion. Unfortunately the 2D graph just looks like randomly scattered points without obvious slope. But indeed there is another variable I can bring in, which is a 1-on-1 map with the signal above (a sequence of same length). The thing is, I can't supply the value of this variable as a regressor when making forecasts because I don't know it yet. Commented Sep 29, 2023 at 16:06
• @HaochenWang, do you know previous values of that variable?
– Cryo
Commented Sep 30, 2023 at 20:07
• Yes. I did some research on this and think the type of problem is called multivariate time series forecasting. Commented Oct 1, 2023 at 17:18