Beveridge-Nelson Filter
bnf.Rd
Based on Replication Files for Kamber, Morley & Wong R conversion of some of the MATLAB codes originally written by Ben Wong
Arguments
- y
vector, eg object of type
ts
- delta_select
integer, set to 0 if use fixed delta, 1 if max amp-to-noise, 2 if min var(trend shocks)
- fixed_delta
integer, set a fixed delta to be used if delta_select=0, or for delta
- p
integer, is lag order for estimation
- d0
integer, min_delta: start point of grid search for delta if delta_select!=0
- dt
integer, delta increment
- demean
character, one of "nd", "sm", "dm", or "pm", where "nd" = no drift, "sm" = sample mean, "dm" = dynamic demeaning, "pm" = structural breaks, set as 'breaks = c(100, 237)'
- iterative
integer, set to >1 for max number of iterations for iterative dynamic demeaning
- dynamic_bands
logical, set to TRUE for dynamic error bands, FALSE for fixed standard error bands
- adjusted_bands
logical, set to TRUE to adjusts for outlier observations when calculating error bands,
- outliers
set outliers as 'outliers = c(293, 294)'
- window
rolling window length for dynamic demeaning and/or dynamic error bands (e.g., 40 is 10 years for quarterly data)
- ib
logical, set to FALSE if no iterative backcasting as in KMW2018 (just unconditional mean), set to TRUE if iterative backcasting
- ...
passed into error bands and piecewise_demean function
Value
List of class "bnf" containing:
call
y
cycle
trend
cycle_se: standard error
delta
demean_method
iterative
cycle_ci
cycle_adjusted_se
cycle_ci_adjusted
iterations
References
Kamber G, Morley J, Wong B (2018). “Intuitive and Reliable Estimates of the Output Gap from a Beveridge-Nelson Filter.” The Review of Economics and Statistics, 100(3), 550-566. ISSN 0034-6535,.
Kamber G, Morley J, Wong B (2025). “Trend-cycle decomposition in the presence of large shocks.” Journal of Economic Dynamics and Control, 173, 105066. ISSN 0165-1889.
Examples
data(usdata)
y <- transform_series(y = usdata$GDPC1, take_log = TRUE, pcode = "p1")
bnfOutput <- bnf(as.vector(y),
delta_select = 2,
demean = "dm",
iterative = 100,
dynamic_bands = TRUE,
adjusted_bands = TRUE,
outliers = c(293, 294),
window = 40,
ib = TRUE)