Title: | Fast Calculation of Spillover Measures |
---|---|
Description: | Functions for computing spillover measures, especially spillover tables and spillover indices, as well as their average, minimal, and maximal values. |
Authors: | Stefan Kloessner [aut, cre], Sven Wagner [aut] |
Maintainer: | Stefan Kloessner <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.1 |
Built: | 2024-12-06 06:41:36 UTC |
Source: | CRAN |
This package comprises various functions for computing spillover measures, especially spillover tables and spillover indices as proposed by Diebold and Yilmaz (2009) as well as their estimated and exact average, minimal, and maximal values.
Package: | fastSOM |
Type: | Package |
Version: | 1.0.0 |
Date: | 2016-07-20 |
License: | GPL (>=2) |
Stefan Kloessner ([email protected]),
with contributions by Sven Wagner ([email protected])
[1] Diebold, F. X. and Yilmaz, K. (2009): Measuring financial asset return and volatitliy spillovers, with application to global equity markets, Economic Journal 199(534): 158-171.
[2] Kloessner, S. and Wagner, S. (2012): Exploring All VAR Orderings for Calculating Spillovers? Yes, We Can! - A Note on Diebold and Yilmaz (2009), Journal of Applied Econometrics 29(1): 172-179
This function calculates the spillover index as proposed by Diebold and Yilmaz (2009, see References).
soi(Sigma, A, ncores = 1, ...)
soi(Sigma, A, ncores = 1, ...)
Sigma |
Either a covariance matrix or a list thereof. |
A |
Either a 3-dimensional array with A[,,h] being MA coefficient matrices of the same dimension as |
ncores |
Number of cores, only relevant if Sigma is a list of matrices.
Missing ncores or |
... |
Further arguments, especially |
The spillover index was introduced by Diebold and Yilmaz in 2009 (see References). It is
based on a variance decompostion of the forecast error variances of an -dimensional MA(
) process.
The underlying idea is to decompose the forecast error of each variable into own variance shares
and cross variance shares. The latter are interpreted as contributions of shocks of one variable
to the error variance in forecasting another variable (see also
sot
).
The spillover index then is a number between 0 and 100, describing the relative amount of forecast error variances that can
be explained by shocks coming from other variables in the model.
The typical application of the 'list' version of soi
is a rolling windows approach when Sigma
and A
are lists representing the corresponding quantities at different points in time
(rolling windows).
Returns a single numeric value or a list thereof.
Stefan Kloessner ([email protected]),
with contributions by Sven Wagner ([email protected])
[1] Diebold, F. X. and Yilmaz, K. (2009): Measuring financial asset return and volatitliy spillovers, with application to global equity markets, Economic Journal 199(534): 158-171.
[2] Kloessner, S. and Wagner, S. (2012): Exploring All VAR Orderings for Calculating Spillovers? Yes, We Can! - A Note on Diebold and Yilmaz (2009), Journal of Applied Econometrics 29(1): 172-179
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate the spillover index soi(Sigma, A)
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate the spillover index soi(Sigma, A)
Calculates an estimate of the average, the minimum, and the maximum spillover index based on different permutations.
soi_avg_est(Sigma, A, ncores = 1, ...)
soi_avg_est(Sigma, A, ncores = 1, ...)
Sigma |
Either a covariance matrix or a list thereof. |
A |
Either a 3-dimensional array with A[,,h] being MA coefficient matrices of the same dimension as |
ncores |
Number of cores. Missing ncores or |
... |
Further arguments, especially |
The spillover index introduced by Diebold and Yilmaz (2009) (see References) depends on the ordering of the model variables.
While soi_avg_exact
provides a fast algorithm for exact calculation of average, minimum, and maximum of the spillover index over all permutations,
there might be reasons to prefer to estimate these quantities using a limited number of permutations (mainly to save time when
is large). This is exactly what
soi_avg_est
does.
The typical application of the 'list' version of soi_avg_est
is a rolling windows approach when Sigma
and A
are lists representing the corresponding quantities at different points in time
(rolling windows).
The 'single' version returns a list containing the estimated average, minimal, and maximal spillover index as well as permutations that generated the minimal and maximal value. The 'list' version returns a list consisting of three vectors (the average, minimal, and maximal spillover index values) and two matrices (the columns of which are the permutations generating the minima and maxima).
Stefan Kloessner ([email protected]),
with contributions by Sven Wagner ([email protected])
[1] Diebold, F. X. and Yilmaz, K. (2009): Measuring financial asset return and volatitliy spillovers, with application to global equity markets, Economic Journal 199(534): 158-171.
[2] Kloessner, S. and Wagner, S. (2012): Exploring All VAR Orderings for Calculating Spillovers? Yes, We Can! - A Note on Diebold and Yilmaz (2009), Journal of Applied Econometrics 29(1): 172-179
fastSOM-package
, soi_avg_exact
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate estimates of the average, minimal, # and maximal spillover index and determine the corresponding ordering # of the model variables soi_avg_est(Sigma, A)
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate estimates of the average, minimal, # and maximal spillover index and determine the corresponding ordering # of the model variables soi_avg_est(Sigma, A)
Calculates the Average, Minimal, and Maximal Spillover Index exactly.
soi_avg_exact(Sigma, A, ncores = 1)
soi_avg_exact(Sigma, A, ncores = 1)
Sigma |
Either a covariance matrix or a list thereof. |
A |
Either a 3-dimensional array with A[,,h] being MA coefficient matrices of the same dimension as |
ncores |
Number of cores. Missing ncores or |
The spillover index introduced by Diebold and Yilmaz (2009) (see References) depends on the ordering of the model variables.
While soi_avg_est
provides an algorithm to estimate average, minimum, and maximum of the spillover index over all permutations,
soi_avg_est
calculates these quantities exactly. Notice, however, that for large dimensions , this might be quite
time- as well as memory-consuming.
If only the exact average of the spillover index is wanted,
soi_from_sot(sot_avg_exact(Sigma,A,ncores)$Average)
should be used.
The typical application of the 'list' version of soi_avg_exact
is a rolling windows approach when Sigma
and A
are lists representing the corresponding quantities at different points in time
(rolling windows).
The 'single' version returns a list containing the exact average, minimal, and maximal spillover index as well as permutations that generated the minimal and maximal value. The 'list' version returns a list consisting of three vectors (the average, minimal, and maximal spillover index values) and two matrices (the columns of which are the permutations generating the minima and maxima).
Stefan Kloessner ([email protected]),
with contributions by Sven Wagner ([email protected])
[1] Diebold, F. X. and Yilmaz, K. (2009): Measuring financial asset return and volatitliy spillovers, with application to global equity markets, Economic Journal 199(534): 158-171.
[2] Kloessner, S. and Wagner, S. (2012): Exploring All VAR Orderings for Calculating Spillovers? Yes, We Can! - A Note on Diebold and Yilmaz (2009), Journal of Applied Econometrics 29(1): 172-179
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate the exact average, minimal, # and maximal spillover index and determine the corresponding ordering # of the model variables soi_avg_exact(Sigma, A)
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate the exact average, minimal, # and maximal spillover index and determine the corresponding ordering # of the model variables soi_avg_exact(Sigma, A)
Given a spillover table, this function calculates the corresponding spillover index.
soi_from_sot(input_table)
soi_from_sot(input_table)
input_table |
Either a spillover table or a list thereof |
The spillover index was introduced by Diebold and Yilmaz in 2009 (see References). It is
based on a variance decompostion of the forecast error variances of an -dimensional MA(
) process.
The underlying idea is to decompose the forecast error of each variable into own variance shares
and cross variance shares. The latter are interpreted as contributions of shocks of one variable
to the error variance in forecasting another variable (see also
sot
).
The spillover index then is a number between 0 and 100, describing the relative amount of forecast error variances that can
be explained by shocks coming from other variables in the model.
The typical application of the 'list' version of soi_from_sot
is a rolling windows approach when input_table
is a list representing the corresponding spillover tables at different points in time
(rolling windows).
Numeric value or a list thereof.
Stefan Kloessner ([email protected]),
with contributions by Sven Wagner ([email protected])
[1] Diebold, F. X. and Yilmaz, K. (2009): Measuring financial asset return and volatitliy spillovers, with application to global equity markets, Economic Journal 199(534): 158-171.
[2] Kloessner, S. and Wagner, S. (2012): Exploring All VAR Orderings for Calculating Spillovers? Yes, We Can! - A Note on Diebold and Yilmaz (2009), Journal of Applied Econometrics 29(1): 172-179
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate spillover table SOT <- sot(Sigma,A) # calculate spillover index from spillover table soi_from_sot(SOT)
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate spillover table SOT <- sot(Sigma,A) # calculate spillover index from spillover table soi_from_sot(SOT)
This function calculates an -dimensional spillover table.
sot(Sigma, A, ncores = 1, ...)
sot(Sigma, A, ncores = 1, ...)
Sigma |
Either a covariance matrix or a list thereof. |
A |
Either a 3-dimensional array with A[,,h] being MA coefficient matrices of the same dimension as |
ncores |
Number of cores, only relevant if Sigma is a list of matrices.
Missing ncores or |
... |
Further arguments, especially |
The -entry of a spillover table represents the relative contribution of shocks in variable
(the column variable) to the forecasting error variance of variable
(the row variable).
Hence, off-diagonal values are interpreted as spillovers, while the own variance shares appear on the
diagonal. An overall spillover measure is given by
soi
.
The typical application of the 'list' version of sot
is a rolling windows approach when Sigma
and A
are lists representing the corresponding quantities at different points in time
(rolling windows).
Matrix, or a list thereof, of dimensions with non-negative entries summing up to 100 for each row.
Stefan Kloessner ([email protected]),
with contributions by Sven Wagner ([email protected])
[1] Diebold, F. X. and Yilmaz, K. (2009): Measuring financial asset return and volatitliy spillovers, with application to global equity markets, Economic Journal 199(534): 158-171.
[2] Kloessner, S. and Wagner, S. (2012): Exploring All VAR Orderings for Calculating Spillovers? Yes, We Can! - A Note on Diebold and Yilmaz (2009), Journal of Applied Econometrics 29(1): 172-179
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate spillover table sot(Sigma,A)
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate spillover table sot(Sigma,A)
Calculates estimates of the average, minimal, and maximal entries of a spillover.
sot_avg_est(Sigma, A, ncores = 1, ...)
sot_avg_est(Sigma, A, ncores = 1, ...)
Sigma |
Either a covariance matrix or a list thereof. |
A |
Either a 3-dimensional array with A[,,h] being MA coefficient matrices of the same dimension as |
ncores |
Number of cores. Missing ncores or |
... |
Further arguments, especially |
The spillover tables introduced by Diebold and Yilmaz (2009) (see References) depend on the ordering of the model variables.
While sot_avg_exact
provides a fast algorithm for exact calculation of average, minimum, and maximum of the spillover table over all permutations,
there might be reasons to prefer to estimate these quantities using a limited number of permutations (mainly to save time when
is large). This is exactly what
sot_avg_est
does.
The typical application of the 'list' version of sot_avg_est
is a rolling windows approach when Sigma
and A
are lists representing the corresponding quantities at different points in time
(rolling windows).
The 'single' version returns a list containing the exact average, minimal, and maximal values for the spillover table. The 'list' version returns a list with three elements (Average, Minimum, Maximum) which themselves are lists of the corresponding tables.
Stefan Kloessner ([email protected]),
with contributions by Sven Wagner ([email protected])
[1] Diebold, F. X. and Yilmaz, K. (2009): Measuring financial asset return and volatitliy spillovers, with application to global equity markets, Economic Journal 199(534): 158-171.
[2] Kloessner, S. and Wagner, S. (2012): Exploring All VAR Orderings for Calculating Spillovers? Yes, We Can! - A Note on Diebold and Yilmaz (2009), Journal of Applied Econometrics 29(1): 172-179
fastSOM-package
, sot_avg_exact
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate estimates of the average, minimal, # and maximal entries within a spillover table sot_avg_est(Sigma, A)
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate estimates of the average, minimal, # and maximal entries within a spillover table sot_avg_est(Sigma, A)
Calculates the exact values of the average, the minimum, and the maximum entries of a spillover tables based on different permutations.
sot_avg_exact(Sigma, A, ncores = 1)
sot_avg_exact(Sigma, A, ncores = 1)
Sigma |
Either a covariance matrix or a list thereof. |
A |
Either a 3-dimensional array with A[,,h] being MA coefficient matrices of the same dimension as |
ncores |
Number of cores, only relevant for 'list' version. In this case, missing ncores or |
The spillover tables introduced by Diebold and Yilmaz (2009) (see References) depend on the ordering of the model variables.
While sot_avg_est
provides an algorithm to estimate average, minimal, and maximal values of the spillover table over all permutations,
sot_avg_est
calculates these quantities exactly. Notice, however, that for large dimensions , this might be quite
time- as well as memory-consuming.
The typical application of the 'list' version of sot_avg_exact
is a rolling windows approach when Sigma
and A
are lists representing the corresponding quantities at different points in time
(rolling windows).
The 'single' version returns a list containing the exact average, minimal, and maximal values for the spillover table. The 'list' version returns a list with three elements (Average, Minimum, Maximum) which themselves are lists of the corresponding tables.
Stefan Kloessner ([email protected]),
with contributions by Sven Wagner ([email protected])
[1] Diebold, F. X. and Yilmaz, K. (2009): Measuring financial asset return and volatitliy spillovers, with application to global equity markets, Economic Journal 199(534): 158-171.
[2] Kloessner, S. and Wagner, S. (2012): Exploring All VAR Orderings for Calculating Spillovers? Yes, We Can! - A Note on Diebold and Yilmaz (2009), Journal of Applied Econometrics 29(1): 172-179
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate the exact average, minimal, # and maximal entries within a spillover table sot_avg_exact(Sigma, A)
# generate randomly positive definite matrix Sigma of dimension N N <- 10 Sigma <- crossprod(matrix(rnorm(N*N),nrow=N)) # generate randomly coefficient matrices H <- 10 A <- array(rnorm(N*N*H),dim=c(N,N,H)) # calculate the exact average, minimal, # and maximal entries within a spillover table sot_avg_exact(Sigma, A)