1982issue C041-7
An odd-length smoother from a cycle cutoff
A power-spectrum cutoff can be rebuilt as a centered odd-length-window. The finite-impulse-response-filter then writes either the two-sided average or a residual high-pass series as a trend-filter.
- A power-spectrum reading that treats short periods as less material can be rebuilt as an odd-length-window by taking twice the half-span plus one.
- Keep weight assignment separate from convolution so a moving-average, a hanning-weight, or a triangular-weight can be swapped without rewriting the rest of the filter.
- The finite-impulse-response-filter writes a centered two-sided average into an output column. A trend-filter can be that smooth or the residual of raw minus smooth.
- Valid output is shortened by the half-span at each end, and the study can be time-shifted before the residual is formed.
How the filter is built
This archive note follows a finite-impulse-response-filter from a cycle cutoff to a two-sided weighted average. The average sits on a finite odd-length-window centered on each observation, with the same number of observations on each side.
A cutoff becomes an odd-length window
Squaring spectral amplitude into a power-spectrum is presented as a way to make important cycle lengths easier to separate from unimportant ones. In the worked construction, the power-spectrum reading treats periods shorter than 20 days as less material for the longer move. That 20-day reading is converted into a 41-day filter that uses a hanning-weight by rebuilding length as twice the half-span plus one.
Swap the weights, keep the convolution
Three weight families are selectable. A moving-average assigns uniform linear weights. A hanning-weight is a cosine taper that down-weights observations farther from the window center. A triangular-weight is a linear taper that declines from the center toward each edge of the window.
The weight-assignment step is isolated so other moving-average weighting schemes can be added without rewriting the rest of the convolution. Chosen length is rebuilt as an odd integer, the weights are accumulated and scaled to unit sum, and the valid output range is shortened by the half-span at each end.
The routine writes a column, not a chart
The supplied routine is a BASIC computational block only. The user must load an ordered series into a fixed matrix, and the filter writes its study into a dedicated output column without printing or charting.
The smooth or the residual as a trend-filter
After smoothing, the study can be time-shifted by a user-specified number of days, then optionally replaced by raw minus smooth to emit a residual high-pass series. The trend-filter is either the smoothed series itself or that optional residual.
All readings on this track · 10 readings
- 1982An odd-length smoother from a cycle cutoff
- 1989Smoothing filters, cutoff, poles, and sample delay
- 1992Constructing a cycle-aware finite impulse response detrender
- 2002Rebuild a smoother by writing the lag into the coefficients
- 2002Timing market cycles with finite impulse response filters and FFT
- 2002Constructing the relative strength index with an even-order finite-impulse-response prefilter
- 2003Recursive and cascaded moving-average construction
- 2006One second-order transfer function, a family of trend filters
- 2019Constructing the Voss line from a bandpass and a short FIR sum
- 2020Truncated bandpass construction as a finite-length trend filter