GithubHelp home page GithubHelp logo

franzmohr / hpconf Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 4.0 241 KB

Confidence bands for the Hodrick-Prescott (HP) Filter as proposed by Giles (2013)

R 100.00%
hp-filter hodrick-prescott-filter confidence-bands

hpconf's Introduction

hpconf

CRAN status R-CMD-check

Overview

The package augments Mehmet Balcilar’s mFilter package by providing a function for the calculation of confidence bands for the trend component of the two-sided Hodrick-Prescott (HP) filter as proposed by Giles (2013).

Note that the construction of such confidence bands is recommended only for stationary times series.

Installation

Development version

# install.packages("devtools")
devtools::install_github("franzmohr/hpconf")

Usage

The following code reproduces figures 3 and 4 in Giles (2013) in one graph.

# Load packages
library(alfred)
library(mFilter)
library(hpconf)

# Download data
unemp <- get_fred_series(series_id = "LNS14100000", series_name = "value",
                         observation_start = "1968-01-01", observation_end = "2012-03-01")

# Transform data into time-series object
unemp <- ts(unemp$value, start = 1968, frequency = 12)

# HP-filter
hp_unemp <- hpfilter(unemp, freq = 14400)

# Obtain confidence bands
hp_unemp_conf <- hpconf(hp_unemp)

# Plot
plot(hp_unemp_conf, main = "US unemployment rate", ylab = "", xlab = "", ylim = c(0, 12))

References

Balcilar, M. (2018). mFilter: Miscellaneous Time Series Filters. R package version 0.1-4. https://CRAN.R-project.org/package=mFilter

Giles, D. E. (2013). Constructing confidence bands for the Hodrick-Prescott filter. Applied Economics Letters (20)5, 480-484. https://doi.org/10.1080/13504851.2012.714057

hpconf's People

Contributors

franzmohr avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.