TAPER Instruction |
TAPER( options ) cseries start end newcseries newstart
Tapers a complex series. A taper is applied to the unpadded part of a complex series prior to taking the Fourier Transform. The taper reduces the “window leakage” by scaling the ends of the data so they merge smoothly with the zeros on either side.
Use of a taper is more important when you are smoothing (with WINDOW) using a window with a sharp cutoff such as the FLAT window. It has much less of an effect with TRIANGULAR or QUADRATIC.
Parameters
cseries |
source series |
start, end |
range to transform. By default, range of cseries, however, you will generally need these because the taper is applied to the unpadded portion of the data. |
newcseries |
result series. By default, overwrite cseries |
newstart |
start for newcseries, by default start |
Options
TYPE=[TRAPEZOIDAL]/COSINE
This gives the type of taper. See "The TYPE option" for technical details.
Note that TAPER has no option analogous to the FORM option of WINDOW. Tapering is simply the multiplication of two series, so you can implement other tapering functions fairly easily using CSET or CMULTIPLY.
FRACTION=fraction of entries affected at each end [.25]
AFFECTED=number of entries affected at each end
Use one of these options to define the number of entries at each end of the series which are affected by the taper. This is the m in the formulas below. FRACTION is the most convenient, specifying a fraction of the overall length. The default is .25 of the length.
Variables Defined
%KAPPA |
the factor to divide into %EBW and %EDF (computed by WINDOW) to correct for the effects of the taper (REAL) |
%SCALETAP |
sum of squared taper weights (REAL). Use this rather than the number of data points when scaling the periodogram. |
TAPER provides two types: TRAPEZOID and COSINE. The taper multiplies the input series by the following (m in these formulas is the number of affected entries at each end):
TRAPEZOID |
\(b\left( t \right) = \left\{ {\begin{array}{*{20}{c}}{{\kern 1pt} t/m} & {\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,1 \le t \le m} \\ {{\kern 1pt} 1} & {\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,m + 1 \le t \le N - m} \\ {{\kern 1pt} \left( {N - t + 1} \right)/m} & {\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,N - m + 1 \le t \le N} \\\end{array}} \right.\) |
COSINE |
\(b\left( t \right) = \left\{ {\begin{array}{*{20}{c}}{0.5{\kern 1pt} {\kern 1pt} \left[ {1 - \cos \left( {\pi {\kern 1pt} t/m} \right)} \right]} & {1 \le t \le m} \\ {{\kern 1pt} 1} & {m + 1 \le t \le N - m} \\ {0.5{\kern 1pt} {\kern 1pt} \left[ {1 - \cos \left( {\pi \left( {N - t + 1} \right)/m} \right)} \right]} & {N - m + 1 \le t \le N} \\ \end{array}} \right.\) |
The corresponding values for \(\kappa\) (%KAPPA) are
TRAPEZOID |
\({\frac{{\left[ {1 - \left( {m/N} \right)\left( {8/5} \right)} \right]}}{{{\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {{\left[ {1 - \left( {m/N} \right)\left( {4/3} \right)} \right]}^2}}}}\) |
COSINE |
\({\frac{{\left[ {1 - 2\left( {m/N} \right)\left( {93/128} \right)} \right]}}{{{{\left[ {1 - 2\left( {m/N} \right)\left( {5/8} \right)} \right]}^2}}}}\) |
Example
This uses a cosine taper affecting 20% of the data on either end.
frequency 3 768
rtoc 1956:1 2002:12
# prices
# 1
taper(type=cosine,fraction=.20) 1 1956:1 2002:12
fft 1
cmult(scale=1./(2*%pi*%scaletap)) 1 1
Copyright © 2025 Thomas A. Doan