Home | Command Reference | Run Example

Spectrum Command

The spectrum command decomposes a time series into recurring cycles. It estimates which cycle lengths explain the most variation in the data and then displays the results as a slideshow of spectral diagnostics.

Example

slideshow(spectrum(unrate))

This example analyzes the U.S. unemployment rate and identifies the dominant periodic structure in the series.

Syntax

spectrum(series)

The input is a single time series. The command estimates the spectral power across different cycle lengths and reconstructs the series using the strongest cyclical components.

Output

The spectrum routine produces several views:

Interpretation

Large spectral power at a given cycle length indicates that the series contains a recurring pattern near that frequency. In the unemployment example, the strongest component occurs around a long business-cycle horizon.

The spectral fit smooths the original data by retaining the dominant cyclical structure while filtering out some of the short-term noise. Sharp shocks, such as the 2020 unemployment spike, may not be fully captured because they are not regular repeating cycles.

The polar chart provides another way to view the same information. The radius measures normalized spectral power, the angle represents phase, and the marker size reflects the relative importance of each cycle.

Typical Use Cases

Notes

The spectrum command is primarily descriptive. It is useful for understanding historical cyclical structure, but it should not be treated as a stand-alone forecasting model.

Strong spectral peaks suggest recurring behavior. Flat or diffuse spectral power suggests that the series is noisy, irregular, or not well explained by a small number of cycles.

Run this example in RainbowStats