RATS 10.1
RATS 10.1

Wizards /

Rolling Analysis Pseudo-Code Generator

Home Page

← Previous Next →

The Rolling Analysis Pseudo-Code Generator is brought up by the Help—Pseudo-Code Generator-Rolling Analysis... operation. It generates pseudo-code for two different types of "rolling sample" analyses. Note well that these are designed only to create the common instructions for such loop types, to help you organize this. The actual estimation and bookkeeping code will have to be added to give them content.
 

The form of the dialog is very similar for the two loop types, and the code generated is also similar. The first is done with Loop Type of "Fixed start, moving end", which would typically be used for testing forecasting procedures. This type of loop at least attempts to simulate the effect of "out-of-sample" forecasting by estimating a model using only the data up to the start of a forecast. A more careful calculation would use the data that would actually have been available at the time, which may be difficult or impossible to obtain, and requires a great deal of specialized data handling since you would have a separate complete data set for each time period. The moving end window is about as close as you can typically come to an assessment of out-of-sample forecasting in practice.
 

This requires you to choose a number of things: a Loop Variable Name (here TIME) which is used for the loop index. The Hold Back Span Name and its value (here SPAN and 50). This is the number of data points at the end that aren't used for the first estimation window. The Usable Range for Analysis is the start to end range over which you can estimate the model. Make sure you allow for lags on the starting side of that. In this case, this is set to 5 and 400. With these settings, the first estimation period will run from 5 to 350 (that is, leaving out the last 50), the next from 5 to 351, etc.
 

If you check Include Progress Bar adds a progress bar (with an optional Title). If your loop requires rather substantial calculation at each stage (for instance, estimating a GARCH model), you might want to do that. If it's just a linear regression or VAR, you probably don't need to bother.


 



 

If you're using this to do forecasts, it's important to decide what your timing is for saving the forecasts. The typical analysis will estimate through entry <<time>> and forecast for <<time+1>> and possibly further. Depending upon the situation, you might want to associate the forecast(s) with the estimation period (thus <<time>>) and in others with the period actually being forecast.

 

With Loop Type of "Moving Window, Fixed Span", the only change to the dialog is that the second field is now called the Span Variable Name and chooses the number of entries to be used in each estimation window (here 200). Note that while this type of analysis is increasingly common, it seems often to be done rather thoughtlessly. Unlike the moving end window, for which the reasoning is clear, it's not that clear why one would want to deny the use of the early part of the sample—with the settings below, the estimation window for the final entry (400) would use only data from 201 to 400. While one could argue that this is allowing for the model to change across the sample, it's also quite possible that your results are simply capturing the effects of sampling variation in the statistics. (See, for instance, rollingcausality.rpf where a fully stable model generates what appear to be unstable results.) And some non-linear models can be very hard to fit successfully when estimated across relatively short windows—a GARCH model in particular can have a great deal of difficulty dealing with a few outliers which suddenly appear in an estimation window.


 


Copyright © 2025 Thomas A. Doan