# Confidence intervals for difference in time series

I have a stochastic model used to simulate time series of some process. I am interested in the effect of changing one parameter to a specific value and want to show the difference between the time series (say model A and model B) and some sort of simulation based confidence interval.

I have been simply running a bunch of simulations from model A and a bunch from model B and then subtracting the medians at each time point to find the median difference throughout time. I used the same approach to find the 2.5 and 97.5 quantiles. This seems like a very conservative approach since I am not considering each time series jointly (e.g., each point is considered independent of all others at previous and future times).

Is there a better way to do this?

• Why use the median, rather than the mean? Are the distributions not symmetric? – naught101 Apr 17 '12 at 10:44
• Were you able to find an answer to this question? – tchakravarty Aug 29 '14 at 11:21
• @TC, this question seems closely related. – Mars Feb 23 '15 at 18:32

## 1 Answer

If you can simulate from the two time series (let's call them $X_t$ and $Y_t$, where $t=1,2,...,T$), and if you simulate from both of them $S$ times so that you get the time series tuples $(\{X_t^s\}_{t=1}^T, \{Y_t^s\}_{t=1}^T)$ for $s = 1,2,...,S$, then instead of calculating the median difference throughout time as \begin{align}\Delta M = \text{median}(X_1^1-Y_1^1, X_2^1-Y_2^1,...,X_T^1-Y_T^1, X_1^2-Y_1^2,...,X_T^S-Y_T^S),\end{align} you could instead simulate from the median difference as a function of time. What I mean by this is that you can define \begin{align}\Delta M(t) = \text{median}( X_t^1-Y_t^1, X_t^2-Y_t^2, ..., X_t^S-Y_t^S),\end{align} so that you now get the median as a function of time. If you can assume that the median is the same across time, the estimates for $\Delta M(t)$ should coincide with the estimate for $\Delta M$ for large enough numbers of simulations $S$. But if the function $\Delta M(t)$ exhibits strong time-dependence (i.e. is very different for different values of $t$), you will be able to see this through simple means as for instance plotting.