corbouli

Corbae-Ouliaris Frequency Domain Filtering

https://github.com/cadam00/corbouli

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 15 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.2%) to scientific vocabulary

Keywords

frequency-domain-filtering r r-package time-series-analysis
Last synced: 9 months ago · JSON representation

Repository

Corbae-Ouliaris Frequency Domain Filtering

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 6
Topics
frequency-domain-filtering r r-package time-series-analysis
Created almost 2 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License

README.md

CRAN status Developmental version R-CMD-check Codecov test coverage zenodo <!-- badges: end -->

Corbae and Ouliaris (2006) Frequency Domain Filter in R

Install

The official (CRAN) version of the package can be installed using r install.packages("corbouli")

Alternatively, the development version of the package can be installed via r if (!require(remotes)) install.packages("remotes") remotes::install_github("cadam00/corbouli")

Citation

To cite the official (CRAN) version of the package, please use

Adam, C. (2025). corbouli: Corbae-Ouliaris Frequency Domain Filtering. R package version 0.1.5. doi:10.32614/CRAN.package.corbouli

Alternatively, to cite the latest development version, please use:

Adam, C. (2025). corbouli: Corbae-Ouliaris Frequency Domain Filtering. (v0.1.5). Zenodo. doi:10.5281/zenodo.13740089

Corbae-Ouliaris Frequency Domain Filtering

Corbae and Ouliaris (2006) Frequency Domain Filter is used for extracting cycles from either both on stationary and non-stationary time series. This is one approximation of the ideal band pass filter of the series. The result is close to the one of the Baxter-King (1999) filter, but end-points are directly estimated and so facing the end-point issue is not faced.

The main idea of this filtering algorithm is illustrated in Fig. 1 and 2. The main idea of the DFTSE subroutine is shown in Fig. 1, where DFT (Discrete Fourier Transform) of the times series, then frequencies lower and higher by periods of oscillation thresholds are assigned to zero and finally IDFT (Inverse Discrete Fourier Transform) are performed. Additional implementation details of this subroutine can be found at source code of the function corbouli::dftse.

Fig. 1: DFTSE subroutine. DFT, censore and IDFT time series.

Fig. 1: DFTSE subroutine.

The final algorithm is described in Fig. 2, where filtered series is the residuals of the regression of $DFTSE(x)$ on $DFTSE$ of the normalized trend.

Fig. 2: Corbae-Ouliaris main algorithm. See corbouli::corbae_ouliaris.

Fig. 2: Corbae-Ouliaris main algorithm.

The minimum and the maximum periods of oscillation should be determined when using this method, so as to irrelevant to filtering frequencies are removed. As an example from Shaw (1947), a business cycle usually has a lower period of 1.5 years and a higher period of 8 years. This information can be used while for filtering as expressed from the following Table 1.

 Sample Frequency Lower Higher
 Month 18 96
 Quarter 6 32
 Year 2 8

Table 1: Lower and higher periods of oscillation.

The same table in fragments of $\pi$ can be transformed into the Table 2 using the $lower\ frequency = 2 / higher\ period$ and $higher\ frequency = 2 / lower\ period$. For instance, for quarterly sampled time series, we have $lower\ frequency = 2 / 32 = 0.0625$ and $higher\ frequency = 2 / 6 = 0.3333$.

 Sample Frequency  Lower Higher
 Month 0.0208 0.1111
 Quarter 0.0625 0.3333
 Year 0.25 1

Table 2: Low and high frequency in fragments of $\pi$.

The longer the series, the more the long run frequency is expressed by a lower frequency as fragment of $\pi$ equal to 0. Moreover, the output gap can be expressed using higher frequency as fragment of $\pi$ equal to 1 (Ouliaris, 2009).

Example

For this example, the quarterly US GDP in billions of chained 2017 dollars (Seasonally adjusted) will be used.

``` r

Import package to workspace

library(corbouli)

Import "USgdp" dataset

data(USgdp)

plot(USgdp, main = "Quarterly US GDP in billions of chained 2017 dollars (Seasonally adjusted)", ylab = "", lwd = 2) ```

Fig. 3: USgdp dataset.

Fig. 3: USgdp dataset.

```r

Extract cycles

co <- corbaeouliaris(USgdp, lowfreq = 0.0625, high_freq = 0.3333)

Plot cycles of filtered series

plot(co, main = "Corbae-Ouliaris FD Filter cycles for USgdp", ylab = "", lwd = 2) ```

Fig. 4: Corbae-Ouliaris FD Filter cycles.

Fig. 4: Corbae-Ouliaris FD Filter cycles.

```r

Plot real data with the ones after removing cycles

Removing cycles from original data

USgdp_rmco <- USgdp - co

Plot Original vs Decycled data

plot(USgdp, main = "Quarterly US GDP in billions of chained 2017 dollars (Seasonally adjusted)", col = "black", lwd = 2, ylab = "") lines(USgdp_rmco, col = adjustcolor("red", alpha.f = 0.7), lwd = 2) legend(x = "topleft", lwd = 2, text.font = 2, col= adjustcolor(c("black","red"), alpha.f = 0.7), legend=c("Original data", "Decycled data")) ```

Fig. 5: Original vs Decycled USgdp data.

Fig. 5: Original vs Decycled USgdp data.

As noted by Ouliaris (2009), for setting high_freq = 1 the output gap series than business cycle one will have higher volatility (Fig. 6).

```r

Extract output gap

og <- corbaeouliaris(USgdp, lowfreq = 0.0625, high_freq = 1)

Plot Business cycle vs Output gap

plot(co, main = "Business cycle vs Output gap for USgdp", col = adjustcolor("blue", alpha.f = 0.7), lwd = 2, ylab = "") lines(og, col = adjustcolor("orange", alpha.f = 0.7), lwd = 2) legend(x = "bottomleft", lwd = 2, text.font = 2, col= adjustcolor(c("blue","orange"), alpha.f = 0.7), legend=c("Business cycle", "Output gap")) ```

Fig. 6: Business cycle vs Output gap.

Fig. 6: Business cycle vs Output gap.

References

Baxter, M., & King, R. (1999), Measuring Business Cycles: Approximate Band-Pass Filters for Economic Time Series. Review of Economics and Statistics 81(4), pp. 575-593.

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

Ouliaris, S. (2009), Ideal Band Pass Filter For Stationary/Non-Stationary Series.

Pérez Pérez, J. (2011), COULIARI: Stata module to implement Corbae-Ouliaris frequency domain filter to time series data. Statistical Software Components, S457218, Boston College Department of Economics.

Shaw, E.S. (1947), Burns and Mitchell on Business Cycles. Journal of Political Economy, 55(4): pp. 281-298. doi:10.1086/256533

Owner

  • Login: cadam00
  • Kind: user

GitHub Events

Total
  • Create event: 2
  • Release event: 2
  • Issues event: 1
  • Watch event: 2
  • Issue comment event: 1
  • Push event: 26
Last Year
  • Create event: 2
  • Release event: 2
  • Issues event: 1
  • Watch event: 2
  • Issue comment event: 1
  • Push event: 26

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: about 1 hour
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: about 1 hour
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Beliavsky (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 270 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
  • Total maintainers: 1
cran.r-project.org: corbouli

Corbae-Ouliaris Frequency Domain Filtering

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 270 Last month
Rankings
Dependent packages count: 28.2%
Dependent repos count: 34.8%
Average: 49.9%
Downloads: 86.6%
Maintainers (1)
Last synced: 10 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/rhub.yaml actions
  • r-hub/actions/checkout v1 composite
  • r-hub/actions/platform-info v1 composite
  • r-hub/actions/run-check v1 composite
  • r-hub/actions/setup v1 composite
  • r-hub/actions/setup-deps v1 composite
  • r-hub/actions/setup-r v1 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • codecov/codecov-action v4 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • stats * imports
  • knitr * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.5.0 composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite