Learn R Programming

mFilter (version 0.1-8)

bnfilter: Beveridge-Nelson filter of a time series

Description

This function implements the Beveridge-Nelson filter for decomposing an integrated time series into a stochastic trend and a cycle. The decomposition is based on the parameters of an ARIMA(p,1,q) model for x

Usage

bnfilter(x,p=NULL,q=NULL,phi=NULL,theta=NULL,drift=NULL)

Value

A "mFilter" object (see mFilter).

Arguments

x

A time series or a vector

p

Integer, the order of the AR part in the ARIMA specification for x. Note that it prevails over the length of the phi argument, if the two are different phi will be coerced to have the same length as p, either by cutting entries in phi excess of p or by estimating further parameters

q

Integer, he order of the MA part in the ARIMA specification for x. Note that it prevails over the length of the theta argument, if the two are different, theta will be coerced to have the same length as p, either by cutting entries in theta in excess of q or by estimating further parameters

phi

A vector of parameters to be used for the Auto Regressive part of the ARIMA model that defines the filter. The parameters should be in reverse time order \((\phi_1, ... ,\phi_p)\). If an entry has value NA, that parameter is left to be estimated

theta

A vector of parameters to be used for the Moving Average part of the ARIMA model that defines the filter. The parameters should be in reverse time order \((\theta_1, ... ,\theta_p)\). If an entry has value NA, that parameter is left to be estimated

drift

The drift (intercept) of the ARIMA model fitted to the differenced series. If left NULL the drift will be estimated. Set to \(0\) to estimate without a drift term.

Author

Matteo Poli

Details

Differently from most filters in this package, the Beveridge Nelson filter decomposes an \(I(1)\) time series by splitting it into a permanent component, the trend, that is a random walk with drift, and a cyclical component that fluctuates around the trend and is an ARMA(p,max{p,q}) process.

This function can be used in the simplest way by specifying bnfilter(x,p,q), which first estimates the parameters of an ARMA model for diff(x) with the arima function and then computes the associated BN decomposition. Otherwise by passing bnfilter(x,phi,theta,drift) one can compute the BN decomposition for the exact set of parameters passed, without any new estimation. The two methods be combined (e.g. passing bnfilter(x,p,theta) to set the MA parameters but estimate the AR ones)

References

Beveridge, S. and Nelson, C., R. (1981). A new approach to decomposition of economic time series into permanent and transitory components with particular attention to measurement of the ‘business cycle’. Journal of Monetary Economics, 7(2), 151-174.

Morley, J. C. (2002). A state–space approach to calculating the Beveridge–Nelson decomposition. Economics Letters, 75, 123-127

See Also

mFilter, bwfilter, cffilter, bkfilter, trfilter

Examples

Run this code
## library(mFilter)

data(unemp)

## example usage
unemp.bn<-bnfilter(unemp,2,2)
summary(unemp.bn)
plot(unemp.bn)

## custom parameters
unemp.bn1<-bnfilter(unemp,phi=0.47,theta=0.15)
summary(unemp.bn1)
plot(unemp.bn1)

## A mix of fixed and estimated parameters
## Here phi_2 will be estimated
unemp.bn2<-bnfilter(unemp,p=2,q=1,phi=0.78,drift=0)
summary(unemp.bn2)
plot(unemp.bn2)
{
  }

Run the code above in your browser using DataLab