Giter Club home page Giter Club logo

tvargirf's Introduction

tvarGIRF

Travis-CI Build Status Coverage Status Lifecycle: maturing

tvarGIRF is an R package that calculates generalised impulse response functions to reduced form shocks for threshold vector autoregressions estimated using the tsDyn package.

Please note: this package is something I put together quickly for an uncompleted project because the only other implementation of GIRFs in R that existed at the time looks like it implements the bootstrap incorrectly to me. According to the tsDyn wiki, GIRFs are now included in the tsDyn package, so you might have better luck with those.

Installation

Install the lastest released version of the package using the R remotes package:

library(remotes)
install_github("angusmoore/tvarGIRF", ref = "v0.1.4")

You can also install the latest development version:

library(remotes)
install_github("angusmoore/tvarGIRF")

Usage

The library extends the R tsDyn package. The following example illustrates how to create a simple GIRF for a threshold VAR using the zeroyld dataset provided with the tsDyn package.

GIRF is given a reduced form shock - in the example below a shock to only the second variable c(0,1). If you want to use orthoganlised shocks, you should calculate the orthogonalisation yourself and supply the reduced form shock that corresponds to your chosen structural shock. It is up to you to identify shocks; tvarGIRF won't do it for you.

library(tsDyn)
library(tvarGIRF)

# Estimate an example TVAR using the zeroyld dataset included in the tsDyn package
data(zeroyld)
exampleTVAR <- TVAR(zeroyld, lag=2, nthresh=1, thDelay=1, mTh=1, plot=FALSE)

# Calculate GIRFs for a reduced form shock to the second variable (long.run)
girfs <- GIRF(exampleTVAR, c(0,1))

The result contains the generalised impulse responses for each variable in the TVAR to the supplied shock. (NB: Since we have not identified shocks, these GIRFs are not very meaningful; this example is designed only to illustrate how to use the library.)

Package documentation

Documentation for this package can be found here.

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.