Home | Command Reference | Run Example

ROLL_BETA Command

The ROLL_BETA command estimates how the relationship between two time series changes through time. Instead of fitting one regression coefficient over the full sample, it repeatedly estimates a beta over a moving window and plots the resulting coefficient as a time series.

Example

ROLL_BETA(logdiff(PAYEMS),logdiff(NOBNDIF066MSFRBPHI+100),30)

This example estimates a 30-month rolling beta between monthly payroll growth and the Philadelphia Fed New Orders diffusion index. The chart shows whether changes in regional manufacturing orders have had a stable relationship with national employment growth.

Syntax

ROLL_BETA(dependentSeries, explanatorySeries, window)

The first input is the dependent series. The second input is the explanatory series. The third input is the rolling window length. For monthly data, a window of 30 means each beta is estimated using the most recent 30 monthly observations.

How It Works

For each rolling window, the command estimates a simple regression:

dependentSeries = alpha + beta * explanatorySeries + error

The estimated beta is then stored at the end date of that window. As the window moves forward, the command creates a time series of rolling beta estimates.

Interpretation

A rolling beta helps determine whether a relationship is stable or regime-dependent. A stable relationship should produce beta values that remain mostly on one side of zero and move within a reasonable range.

Why Rolling Beta Matters

A full-sample regression can make a relationship appear stronger than it really is. A few unusual periods, such as recessions, financial crises, or pandemic shocks, can dominate the full-sample estimate.

The ROLL_BETA command exposes this problem by showing whether the estimated coefficient is persistent through time. If the beta repeatedly changes sign or swings sharply, the relationship should not be treated as a stable forecasting rule.

Typical Use Cases

Example Interpretation

In the payroll and Philadelphia Fed New Orders example, a full-sample model may show a strong relationship. However, the rolling beta can reveal that the coefficient changes sign and varies sharply across time. That suggests the relationship is not stable enough to use as a standalone payroll forecasting model.

This makes ROLL_BETA useful as a diagnostic tool. It helps distinguish between a durable economic relationship and a regression result that is driven by temporary regimes or outliers.