Git Product home page Git Product logo

var_t-var's Introduction

The tVAR package allows R users to estimate the penalized Vector AutoRegression model with t-distributed innovations (t-VAR) proposed in Barbaglia et al.ย (2020). The package allows to compute the resulting volatility spillovers and visualize them via networks.

Installation

You can install tVAR from GitHub as follows:

install.packages("devtools")
devtools::install_github("lucabarbaglia/t-VAR")

Fit a t-VAR with estimated of the degrees of freedom

Fit a penalized t-VAR of order P=2 on the RV data set containing the log-transformed realized volatilities for J=5 stocks and N=500 observations.

library(tVAR)
data(RV)
DATA <- as.matrix(RV)
fit <- Large.tVAR(Data=DATA, P=2, lambda1_OPT = 5, gamma1_OPT = 0.2) 
str(fit, max.level = 1)
#> List of 11
#>  $ Beta_new   : num [1:50, 1] 0.0993 0.024 0.0528 0.0681 0.033 ...
#>   ..- attr(*, "dimnames")=List of 2
#>  $ Beta_arr   : num [1:5, 1:5, 1:2] 0.0993 0.024 0.0528 0.0681 0.033 ...
#>  $ innov      : num [1:498, 1:5] 0.369 0.987 0.943 0.784 1.045 ...
#>  $ Omega_new  : num [1:5, 1:5] 1 0 0 0 0 ...
#>  $ tau_new    : num [1:498, 1] 0.0693 0.4841 1.0158 0.391 0.1396 ...
#>  $ nu_new     : num 1.71
#>  $ Obj_ECM    : num [1:25] 1 -5453 -1446 1 1 ...
#>  $ iter_ECM   : num 4
#>  $ iter_vec   : num [1:25, 1] NA 8 7 NA NA NA NA NA NA NA ...
#>  $ lambda1_opt: num 5
#>  $ gamma1_opt : num 0.2

The output of the Large.tVAR function is a list containing, among other ones, the following objects:

  • Beta_arr: a JxJxP array containing the estimated autoregressive coefficients;

  • Omega_new: a JxJ matrix containing the estimated variance-covariance matrix;

  • nu_new: estimated degrees-of-freedom of the multivaraite t-distribution of the VAR innovations.

  • lambda1_opt: selected value of the regularization parameter on the autoregressive coefficients;

  • gamma1_opt: selected value of the regularization parameter on the variance-covariance matrix

If you do not wish to specify the magnitude of the penalization, you select it via BIC by setting the paramaters lambda1_min, lambda1_max, lambda1_steps. If you do not wish to estimate the degrees-of-freedom of the multivariate t distribution of the VAR innovations, you can use the EM_VAR function.

Volatilty spillover networks

Build the volatility spillovers from the t-VAR estimation.

# Volatility Spillovers:
vs <- Spillovers(fit = fit)
vs$spill_index      # volatility spillover index
#> [1] 14.97478

# volatility spillover matrix
spills <- vs$spill
colnames(spills) <- rownames(spills) <- colnames(RV)
round(spills,2)
#>        stock1 stock2 stock3 stock4 stock5
#> stock1  94.45   3.10   0.96   1.44   0.04
#> stock2   0.11  96.81   2.75   0.31   0.03
#> stock3   0.31   0.54  97.97   0.36   0.83
#> stock4   0.57   1.39   1.26  96.56   0.22
#> stock5   0.12   0.49   0.11   0.04  99.24

Plot the network of volatility spillovers.

# Volatility spillover network:
network.vs(spill=round(spills))

References:

  • Barbaglia, L., Croux, C., & Wilms, I. (2020). Volatility spillovers in commodity markets: A large t-vector autoregressive approach. Energy Economics, 85, 104555.

var_t-var's People

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.