Title: | Corbae-Ouliaris Frequency Domain Filtering |
---|---|
Description: | Corbae-Ouliaris frequency domain filtering. According to Corbae and Ouliaris (2006) <doi:10.1017/CBO9781139164863.008>, this is a solution for extracting cycles from time series, like business cycles etc. when filtering. This method is valid for both stationary and non-stationary time series. |
Authors: | Christos Adam [aut, cre] |
Maintainer: | Christos Adam <[email protected]> |
License: | GPL-3 |
Version: | 0.1.3 |
Built: | 2024-11-25 14:52:59 UTC |
Source: | CRAN |
Corbae-Ouliaris (2006) Frequency Domain Filter
corbae_ouliaris(x, low_freq = NULL, high_freq = NULL)
corbae_ouliaris(x, low_freq = NULL, high_freq = NULL)
x |
Vector, |
low_freq |
Number indicating the lowest period of oscillation as fractions of |
high_freq |
Number indicating the highest period of oscillation as radians of |
This is a pure R implementation of the filtering algorithm. low_freq
and
high_freq
are connected with characteristics of the series, for example
the business circle. low_freq
and high_freq
must be both either
between 0 and 1, meaning that they are frequencies of the period as radians, or
both >1, indicating that both are starting and ending periods of the cycle.
low_freq
and high_freq
are used for keeping the relevant
frequencies. These are meant to be the ones inside the range
. Therefore, values outside this range are
removed.
For 2-dimensional objects x
, filtering per column is applied.
Filtered object with the same length/dimensions and class as the input x
.
Corbae, D., Ouliaris, S., & Phillips, P. (2002), Band Spectral Regression with Trending-Data. Econometrica 70(3), pp. 1067-1109.
Corbae, D. & Ouliaris, S. (2006), Extracting Cycles from Nonstationary Data, in Corbae D., Durlauf S.N., & Hansen B.E. (eds.). Econometric Theory and Practice: Frontiers of Analysis and Applied Research. Cambridge: Cambridge University Press, pp. 167–177. doi:10.1017/CBO9781139164863.008.
Shaw, E.S. (1947), Burns and Mitchell on Business Cycles. Journal of Political Economy, 55(4): pp. 281-298. doi:10.1086/256533.
# Apply on ts data(USgdp) res <- corbae_ouliaris(USgdp, low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on vector data(USgdp) res <- corbae_ouliaris(USgdp, low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on matrix per column mat <- matrix(USgdp, ncol = 4) res <- corbae_ouliaris(mat, low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on data.frame per column dfmat <- as.data.frame(mat) res <- corbae_ouliaris(dfmat, low_freq = 0.0625, high_freq = 0.3333) head(res)
# Apply on ts data(USgdp) res <- corbae_ouliaris(USgdp, low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on vector data(USgdp) res <- corbae_ouliaris(USgdp, low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on matrix per column mat <- matrix(USgdp, ncol = 4) res <- corbae_ouliaris(mat, low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on data.frame per column dfmat <- as.data.frame(mat) res <- corbae_ouliaris(dfmat, low_freq = 0.0625, high_freq = 0.3333) head(res)
Remove irrelevant frequencies
dftse(x, low_freq = NULL, high_freq = NULL)
dftse(x, low_freq = NULL, high_freq = NULL)
x |
Vector, |
low_freq |
Number indicating the lowest period of oscillation as fractions of |
high_freq |
Number indicating the highest period of oscillation as radians of |
This is a pure R implementation of removing the irrelevant frequencies. First,
DFT is applied on the data and this result is filtered according to
low_freq
and high_freq
. Finally, an inverse DFT is performed on
these relevant frequencies. Both low_freq
and high_freq
must be
either between 0 and 1, meaning that they are frequencies of the period as
radians, or both >1, indicating that both are starting and ending periods of the
cycle.
low_freq
and high_freq
are used for keeping the relevant
frequencies. These are meant to be the ones inside the range
. Therefore, values outside this range are
removed.
For 2-dimensional objects x
, this transformation is applied per column.
Filtered object with length/dimensions same with the input x. Note that for
inputs with dimensions (e.g. matrix
, data.frame
) a matrix
object will be returned.
Corbae, D., Ouliaris, S., & Phillips, P. (2002), Band Spectral Regression with Trending-Data. Econometrica 70(3), pp. 1067-1109.
Corbae, D. & Ouliaris, S. (2006), Extracting Cycles from Nonstationary Data, in Corbae D., Durlauf S.N., & Hansen B.E. (eds.). Econometric Theory and Practice: Frontiers of Analysis and Applied Research. Cambridge: Cambridge University Press, pp. 167–177. doi:10.1017/CBO9781139164863.008.
Shaw, E.S. (1947), Burns and Mitchell on Business Cycles. Journal of Political Economy, 55(4): pp. 281-298. doi:10.1086/256533.
# Apply on ts object data(USgdp) res <- dftse(USgdp, low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on vector res <- dftse(c(USgdp), low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on matrix per column mat <- matrix(USgdp, ncol = 4) res <- dftse(mat, low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on data.frame per column dfmat <- as.data.frame(mat) res <- dftse(dfmat, low_freq = 0.0625, high_freq = 0.3333) head(res)
# Apply on ts object data(USgdp) res <- dftse(USgdp, low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on vector res <- dftse(c(USgdp), low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on matrix per column mat <- matrix(USgdp, ncol = 4) res <- dftse(mat, low_freq = 0.0625, high_freq = 0.3333) head(res) # Apply on data.frame per column dfmat <- as.data.frame(mat) res <- dftse(dfmat, low_freq = 0.0625, high_freq = 0.3333) head(res)
Quarterly US GDP in billions of chained 2017 dollars (Seasonally adjusted) series from 1947.1 to 2019.4.
number of observations : 292
observation : country
country : United States
data(USgdp)
data(USgdp)
A monthly time series, in billions of chained 2017 dollars.
A ts
object.
Bureau of Economic Analysis.
U.S. Bureau of Economic Analysis. (2024). Current-dollar and “real” GDP. Retrieved from BEA website. https://www.bea.gov/
# Apply on vector data(USgdp) USgdp
# Apply on vector data(USgdp) USgdp