Spectral Plot
NIST/SEMATECH Section 1.3.3.27 Spectral Plot
What It Is
A spectral plot is a graphical technique for examining cyclic structure in the frequency domain. It is a smoothed Fourier transform of the autocovariance function. The frequency is measured in cycles per unit time where unit time is defined to be the distance between two points. A frequency of 0 corresponds to an infinite cycle while a frequency of 0.5 corresponds to a cycle of 2 data points. Equi-spaced time series are inherently limited to detecting frequencies between 0 and 0.5.
The spectral plot is formed with the vertical axis showing smoothed variance (power) and the horizontal axis showing frequency (cycles per observation). The smoothed variances are computed via the Fourier transform of the autocovariance function. Sharp peaks indicate periodic components. The frequency resolution is 1/N where N is the series length.
Questions This Plot Answers
- How many cyclic components are there?
- Is there a dominant cyclic frequency?
- If there is a dominant cyclic frequency, what is it?
Why It Matters
The spectral plot is the primary technique for assessing the cyclic nature of univariate time series in the frequency domain. It is almost always the second plot (after a run sequence plot) generated in a frequency domain analysis of a time series.
When to Use a Spectral Plot
Use a spectral plot when the goal is to identify dominant frequencies, periodicities, or cyclic patterns in time series data. Trends should typically be removed from the time series before applying the spectral plot. Trends can be detected from a run sequence plot and are typically removed by differencing the series or by fitting a straight line and applying the spectral analysis to the residuals. Spectral plots are often used to find a starting value for the frequency in the sinusoidal model .
How to Interpret a Spectral Plot
The horizontal axis represents frequency in cycles per observation and the vertical axis represents smoothed variance (power). Sharp peaks in the spectral plot indicate dominant periodic components at those frequencies. The frequency of a peak can be converted to a period by taking its reciprocal. A flat spectrum indicates white noise with equal power at all frequencies, consistent with random data. A spectrum that starts with a dominant peak near zero and decays rapidly indicates strong positive autocorrelation where an autoregressive model is appropriate. A single sharp peak at a non-zero frequency indicates an underlying sinusoidal model.
Examples
White Noise
A flat, featureless spectrum with no dominant peaks and no identifiable pattern. The peaks fluctuate at random. This type of appearance indicates that there are no significant cyclic patterns in the data and the data are random. Corresponds to NIST Example 1 (200 normal random numbers).
Autoregressive
A strong dominant peak near zero frequency that decays rapidly toward zero. This is the spectral plot signature of a process with strong positive autocorrelation. Such processes are highly non-random in that there is high association between an observation and a succeeding observation. An autoregressive model is appropriate. The next step would be to determine the model parameters and then investigate the source of the autocorrelation: is it the phenomenon under study, drifting in the environment, or contamination from the data acquisition system?
Single Frequency
A single dominant peak at a specific frequency, indicating an underlying single-cycle sinusoidal model. The proper model is , where is the amplitude, is the frequency (between 0 and 0.5 cycles per observation), and is the phase. The recommended next steps are to estimate the frequency from the spectral plot, use a complex demodulation phase plot to fine-tune the estimate, and carry out a non-linear fit of the sinusoidal model.
Assumptions and Limitations
Trends should be removed before applying spectral analysis, as they can distort the spectrum. The computations for generating the smoothed variances can be involved; details can be found in Jenkins and Watts (1968) and Bloomfield (1976). The frequency resolution depends on the length of the time series: longer series provide finer frequency resolution.
See It In Action
This technique is demonstrated in the following case studies:
Reference: NIST/SEMATECH e-Handbook of Statistical Methods, Section 1.3.3.27
Formulas
Sinusoidal Model
The sinusoidal time series model where alpha is the amplitude, omega is the frequency (between 0 and 0.5 cycles per observation), and phi is the phase. Spectral plots are often used to find a starting value for omega in this model.
Autoregressive Model
When the spectral plot shows a dominant peak near zero that decays rapidly, this autoregressive model is appropriate. The parameters can be estimated by linear regression or by fitting a Box-Jenkins AR model.
Frequency Range
The frequencies range from 0 (infinite cycle) to 0.5 (cycle of 2 data points). The frequency resolution is 1/N, determined by the series length.
Python Example
import numpy as npimport matplotlib.pyplot as pltfrom scipy.signal import periodogram
# Sinusoidal signal at 0.3 cycles/observation (NIST LEW.DAT pattern)rng = np.random.default_rng(42)n = 200t = np.arange(n)signal = 10 * np.sin(2 * np.pi * 0.3 * t) + rng.standard_normal(n)
freqs, psd = periodogram(signal, fs=1.0)
# Skip DC component (freq=0) for clearer displaymask = freqs > 0fig, ax = plt.subplots(figsize=(8, 4))ax.plot(freqs[mask], psd[mask])ax.set_xlabel("Frequency (cycles/observation)")ax.set_ylabel("Smoothed Variance (Power)")ax.set_title("Spectral Plot — Dominant Frequency at 0.3")ax.set_ylim(bottom=0)plt.tight_layout()plt.show()