2
$\begingroup$

The Context

Let's say for argument's sake that I have a time series dataset, $X_t$, that is stationary, exhibits strong autocorrelation and is a good candidate for an ARIMA-type model.

I have a series of observations for this time series variable, $(X_{1,0},X_{1,1},...X_{1,N})$ which is evenly distributed in time and has no gaps.

I also have a second series of observations for this time series variable, from a different and non-overlapping time period, $(X_{2,0},X_{2,1},...X_{2,N})$, such the time $t$ at $X_{2,0}$ is much greater than the time $t$ at $X_{1,N}$.

The time series between $X_{1,N}$ and $X_{2,0}$ is unobservable.

I expect the same ARIMA model to be a good fit to both of these series (since it is just the same time series, measured from a different starting point).

The Problem

In Python, how can I fit my ARIMA model to both series of observations simultaneously? And if a third series, $(X_{3,0},X_{3,1},...X_{3,N})$, becomes available how can I improve the fit of the ARIMA model given the new data?

I've seen a number of different approaches online but I'm not convinced by any of them.

They seem to suggest concatenating the series together and treating them as a single time series, which I don't believe is a good option because the series are not contiguous.

The alternative I've seen is to use a library like pmdarima which has an .update() method. It's unclear to me whether pmdarima simply concatenates the new series onto the old series, and even if it doesn't, it seems like it would just refit the model to the new series using the old parameters as a starting point, rather than fitting to the whole set of observations.

I may be missing something here, this seems like it should be such a common problem and should be readily solved.

$\endgroup$
1

1 Answer 1

1
$\begingroup$

You have three vectors $X_1, X_2, X_3$ generated by the same data generating process. There can be three cases:

  1. The time gaps between $X_1, X_2, X_3$ are short and of known length.
  2. The time gaps between $X_1, X_2, X_3$ are short but of unknown length.
  3. The time gaps between $X_1, X_2, X_3$ are long.

In case of 1, fill in the gaps between $X_1, X_2, X_3$ by an appropriate number of NA values to make one long vector $Y$. Use the usual ARIMA fitting routine. The state-space representation and Kalman filtering in the fitting routine should be able to deal with NA values without a problem. This works in R e.g. using forecast::auto.arima. Hopefully it will work in Python as well.
In case of 2, I am not sure what to do...
In case of 3, the dependence between $X_1, X_2, X_3$ is negligible. Create a long vector $e$ that consists entirely of NA values. Concatenate $X_1, e, X_2, e, X_3$ into one looong vector $Y$. Placing the $e$ vector in between the $X$s effectively breaks up time dependence between them during fitting. (The idea is not mine. I have borrowed it from some old post probably by Rob J. Hyndman.) Proceed further as in case 1.

$\endgroup$
2
  • $\begingroup$ ah ok, makes sense. In Case 3 It seems like the length of the vector $e$ should be set as long enough for the impact of the last element of $X_2$ on the first element of $X_3$ to be approximately zero? So it wouldn't necessarily need to be determined by the actual length of time between $X_2$ and $X_3$? $\endgroup$
    – Andy Smith
    Commented Dec 15, 2023 at 11:06
  • $\begingroup$ @AndySmith, yes, I think so. $\endgroup$ Commented Dec 15, 2023 at 11:16

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.