bkfilter
Syntax
Description
Separate one or more time series into additive trend and cyclical components by
applying the Baxter-King filter
[1]. bkfilter
optionally plots the series and smoothed trend component,
with cycles removed.
In addition to the Baxter-King filter, Econometrics Toolbox™ supports the Christiano-Fitzgerald (cffilter
), Hamilton
(hfilter
), and
Hodrick-Prescott (hpfilter
) filters.
[
returns the additive trend Trend
,Cyclical
] = bkfilter(Y
)Trend
and cyclical
Cycilcal
components from applying the Baxter-King filter to each
variable (column) of the input matrix of time series data Y
, using
the definition of a business cycle in [2] for quarterly data.
[
returns the tables or timetables TTbl
,CTbl
] = bkfilter(Tbl
)TTbl
and CTbl
containing variables for the trend and cyclical components, respectively, from applying
the Baxter-King filter to each variable in the input table or timetable
Tbl
. To select different variables in Tbl
to
filter, use the DataVariables
name-value argument.
[___] = bkfilter(___,
specifies options using one or more name-value arguments in
addition to any of the input argument combinations in previous syntaxes.
Name=Value
)bkfilter
returns the output argument combination for the
corresponding input arguments. For example,
bkfilter(Tbl,Stationarity=true,DataVariables=1:5)
applies the
Baxter-King filter to the first five variables in the input table Tbl
and specifies at all input series are stationary.
bkfilter(___)
plots time series variables in the
input data and their respective smoothed trend components (cycles removed), computed by
the Baxter-King filter, on the same axes.
bkfilter(
plots on the axes specified by ax
,___)ax
instead of
the current axes (gca
). ax
can precede any of the input
argument combinations in the previous syntaxes.
Examples
Input Arguments
Output Arguments
More About
Tips
Baxter and King [1] suggest values in the table for the cutoff period
name-value arguments LowerCutoff
and UpperCutoff
,
and lag length name-value argument LagLength
that depend on the
periodicity of the data.
Periodicity | LowerCutoff | UpperCutoff | LagLength |
---|---|---|---|
Yearly | 2 | 8 | 3 |
Quarterly | 6 | 32 | 12 |
Monthly | 18 | 96 | 36 |
In practice, use vectors of cutoff periods and lag lengths to test alternatives. Use the
plot produced by bkfilter
to compare results among settings.
References
Version History
Introduced in R2023a