Questions tagged [moving-window]

A window is a fixed-length subset of consecutive observations of a time series. The window is moved along the time series at a constant rate. AKA "rolling window".

A window is a fixed-length subset of consecutive observations of a time series. The window is moved along the time series at a constant rate. Also known as a "rolling window".

A basic use of a moving window is to inspect stationarity of a time series. Descriptive statistics of a stationary series would change little from one window to another, while those of a nonstationary series may change a lot.

More popular uses of a moving window are to evaluate predictive accuracy, stability and other properties of a model, as well as to select a model from several candidates. A model is reestimated and a forecast is made in each window, for a number of windows. The forecasts are compared to the realizations to asses their accuracy. Unlike in-sample forecast evaluation, a moving window offers a fair evaluation of forecast accuracy because future data are not used in estimation of the model parameters.

A moving window offers a form of cross validation for time series models when model errors cannot be assumed to be i.i.d. over time.

87 questions
21
votes
3 answers

I'm getting "jumpy" loadings in rollapply PCA in R. Can I fix it?

I have 10 years of daily returns data for 28 different currencies. I wish to extract the first principal component, but rather than operate PCA on the whole 10 years, I want to rollapply a 2 year window, because the currencies' behaviours evolve and…
Thomas Browne
  • 819
  • 1
  • 16
  • 28
9
votes
1 answer

What is the autocorrelation function of a time series arising from computing a moving standard deviation?

Say I have a time series of observations and I compute a measure of the variance of that time series as the standard deviation (SD) in a rolling window of width $w$ and that window is moved in single time steps over the series. Assume further that…
Gavin Simpson
  • 37,567
  • 5
  • 110
  • 153
9
votes
4 answers

Tuning an exponential moving average to a moving window mean?

The alpha parameter of an exponential moving average defines the smoothing that the average applies to a time series. In a similar way, the window size of a moving window mean also defines the smoothing. Is there some way to tune the alpha parameter…
7
votes
3 answers

How to determine moving window size?

I am using moving window technique for data analysis... For example I compute the mean, the standard deviation and etc. for a given window. And I wonder if there's any good criterion to determine window size... I thought of computing multivariate…
KH Kim
  • 1,121
  • 2
  • 10
  • 25
6
votes
1 answer

DNA: The number of 'AAAAA'-s in a randomly generated DNA sequence that's 1000 base pairs long

Let's say I have a randomly generated sequence consisting of letters A, C, T and G that's 1000 letters long. The probability of each letter occurring is 25%. What is the probability that the sequence 'AAAAA' will occur N times within the 1000-letter…
6
votes
1 answer

How to decide moving window size for time series prediction?

I have a model to predict +1 day ahead of this time series. Looking at the chart you can notice some seasonality every 5 days. I suspect using a moving window as training set could help me making a better prediction. However I want to…
5
votes
0 answers

Can you use a moving average as an instrumental variable?

I have panel data and am interested in changes in total expenditures. I would like to consider an instrumental variable approach to deal with an endogenous regressor – the short run elasticity of income, lagged by 3 years. There are two ways I can…
4
votes
2 answers

Selecting ARIMA Order using Rolling Forecast

I'm wondering if a rolling forecast technique like the ones mentioned in Rob Hyndman's blogs, and the example below, could be used to select the order for an ARIMA model? In the examples I've looked at, like the ones below, it seems like the order…
4
votes
1 answer

Are rolling forecasts more accurate that full-sample forecasts?

I compared the auto.arima forecast checkts below to the rolling forecast fc and noticed that every of the error measures is lower for fc. Will rolling forecasts have lower errors than a forecasted auto.arima model in general? Why might that…
modLmakur
  • 239
  • 1
  • 2
  • 6
4
votes
0 answers

improve performance of finding rolling window maximum likelihood

There is data indexed by time: $$ D_1, D_2, D_3, ..., D_T $$ I have a model that I assume the parameter $\theta_t$ changes with time $t$. As a result, I adapt a rolling window strategy: $$ \theta_{t+1} = \underset{\theta}{\arg…
4
votes
2 answers

How can I estimate the sliding window standard deviation of a stream?

I am processing a stream of database records. At current levels, about 250 million records are added per week, but this will increase. I wish to compute the 90-day sliding window standard deviation of values taken from these records. I may later…
Paul Chernoch
  • 196
  • 1
  • 7
3
votes
1 answer

Is moving average(sliding window) a smoothing technique or forecasting technique?

The rolling average method is mostly used to produce a smoothed series by removing noise. For ex- 3 window moving average, in general practice, the output for the fourth period is the 3 window moving average of first 3 periods. So in this process we…
3
votes
1 answer

Efficient online (rolling window) estimation of a GARCH model

I have a time series $x_t$ of length $n$. I would like to model it using rolling window approach with window length (width) $w$: window $1$: $x_1,\dots,x_w$, window $2$: $x_2,\dots,x_{w+1}$, $\dots$, window $n-w+1$: $x_{n-w+1},\dots,x_n$. In each…
Richard Hardy
  • 54,375
  • 10
  • 95
  • 219
3
votes
1 answer

Computation of multiple linear OLS regression with rolling window and/or update

How can I efficiently calculate an OLS fit for N multiple variables for a rolling window? I've worked out how to do it for 1 and 2 variable linear fits, I'd like to extend to the general case of N variables if possible (or at least to 3). I don't…
Justin
  • 131
  • 3
3
votes
0 answers

Good book / resource for learning about moving window PCA?

I would like recommendations on textbooks (or online resources) covering MWPCA theoretically and with application examples (preferably in R, but also in Python, Mathematica, Matlab). A brief intro: Moving Window Principal Component Analysis is the…
Oleg Melnikov
  • 181
  • 1
  • 10
1
2 3 4 5 6