GFEVD {gmvarkit} | R Documentation |
Estimate generalized forecast error variance decomposition for structural (and reduced form) GMVAR, StMVAR, and G-StMVAR models.
Description
GFEVD
estimates generalized forecast error variance decomposition for structural
(and reduced form) GMVAR, StMVAR, and G-StMVAR models.
Usage
GFEVD(
gsmvar,
shock_size = 1,
N = 30,
initval_type = c("data", "random", "fixed"),
R1 = 250,
R2 = 250,
init_regimes = NULL,
init_values = NULL,
which_cumulative = numeric(0),
include_mixweights = FALSE,
ncores = 2,
seeds = NULL
)
## S3 method for class 'gfevd'
plot(x, ...)
## S3 method for class 'gfevd'
print(x, ..., digits = 2, N_to_print)
Arguments
gsmvar |
an object of class |
shock_size |
What shocks size should be used for all shocks? By the definition of the SGMVAR, SStMVAR, and SG-StMVAR model, the conditional covariance matrix of the structural shock is identity matrix. |
N |
a positive integer specifying the horizon how far ahead should the GFEVD be calculated. |
initval_type |
What type initial values are used for estimating the GIRFs that the GFEVD is based on?
|
R1 |
the number of repetitions used to estimate GIRF for each initial value. |
R2 |
the number of initial values to be drawn if |
init_regimes |
a numeric vector of length at most |
init_values |
a size |
which_cumulative |
a numeric vector with values in |
include_mixweights |
should the GFEVD be estimated for the mixing weights as well? Note that this is
ignored if |
ncores |
the number CPU cores to be used in parallel computing. Only single core computing is supported if an initial value is specified (and the GIRF won't thus be estimated multiple times). |
seeds |
a numeric vector containing the random number generator seed for estimation of each GIRF. Should have the length...
Set to |
x |
object of class |
... |
currently not used. |
digits |
the number of decimals to print |
N_to_print |
an integer specifying the horizon how far to print the estimates. The default is that all the values are printed. |
Details
The model DOES NOT need to be structural in order for this function to be
applicable. When an identified structural GMVAR, StMVAR, or G-StMVAR model is
provided in the argument gsmvar
, the identification imposed by the model
is used. When a reduced form model is provided in the argument gsmvar
,
lower triangular Cholesky identification is used to identify the shocks.
The GFEVD is a forecast error variance decomposition calculated with the generalized impulse response function (GIRF). Lanne and Nyberg (2016) for details. Note, however, that the related GIRFs are calculated using the algorithm given in Virolainen (2022).
Value
Returns and object of class 'gfevd' containing the GFEVD for all the variables and if
include_mixweights=TRUE
also to the mixing weights. Note that the decomposition does not
exist at horizon zero for mixing weights because the related GIRFs are always zero at impact.
Functions
-
plot(gfevd)
: plot method -
print(gfevd)
: print method
References
Lanne M. and Nyberg H. 2016. Generalized Forecast Error Variance Decomposition for Linear and Nonlineae Multivariate Models. Oxford Bulletin of Economics and Statistics, 78, 4, 595-603.
Kalliovirta L., Meitz M. and Saikkonen P. 2016. Gaussian mixture vector autoregression. Journal of Econometrics, 192, 485-498.
Virolainen S. (forthcoming). A statistically identified structural vector autoregression with endogenously switching volatility regime. Journal of Business & Economic Statistics.
Virolainen S. 2022. Gaussian and Student's t mixture vector autoregressive model with application to the asymmetric effects of monetary policy shocks in the Euro area. Unpublished working paper, available as arXiv:2109.13648.
See Also
GIRF
, linear_IRF
, fitGSMVAR
, GSMVAR
,
gsmvar_to_sgsmvar
, reorder_W_columns
, swap_W_signs
, simulate.gsmvar
Examples
# These are long-running examples that use parallel computing.
# It takes approximately 30 seconds to run all the below examples.
## StMVAR(1, 2), d=2 model identified recursively by lower-triangular
## Cholesky decomposition (i.e., reduced form model is specified):
params12t <- c(0.55, 0.11, 0.34, 0.05, -0.01, 0.72, 0.58, 0.01, 0.06, 0.17,
0.25, 0.34, 0.05, -0.01, 0.72, 0.50, -0.01, 0.20, 0.60, 3.00, 12.00)
mod12t <- GSMVAR(gdpdef, p=1, M=2, params=params12t, model="StMVAR")
# Estimating the GFEVD using all possible histories in the data as the
# initial values:
gfevd0 <- GFEVD(mod12t, N=24, R1=10, initval_type="data")
gfevd0
plot(gfevd0)
## NOTE: Use larger R1 is empirical applications! Small R1 is used
## here only to fasten the execution time of the examples.
## Structural GMVAR(2, 2), d=2 model identified with sign-constraints:
params22s <- c(0.36, 0.121, 0.484, 0.072, 0.223, 0.059, -0.151, 0.395,
0.406, -0.005, 0.083, 0.299, 0.218, 0.02, -0.119, 0.722, 0.093, 0.032,
0.044, 0.191, 0.057, 0.172, -0.46, 0.016, 3.518, 5.154, 0.58)
W_22 <- matrix(c(1, 1, -1, 1), nrow=2, byrow=FALSE)
mod22s <- GSMVAR(gdpdef, p=2, M=2, params=params22s,
structural_pars=list(W=W_22))
mod22s
# Alternatively, use:
#fit22s <- fitGSMVAR(gdpdef, p=2, M=2, structural_pars=list(W=W_22),
# ncalls=20, seeds=1:20)
# To obtain an estimated version of the same model.
# Estimating the GFEVD using all possible histories in the data as the
# initial values:
gfevd1 <- GFEVD(mod22s, N=24, R1=10, initval_type="data")
gfevd1
plot(gfevd1)
# Estimate GFEVD with the initial values generated from the stationary
# distribution of the process:
gfevd2 <- GFEVD(mod22s, N=24, R1=10, R2=100, initval_type="random")
gfevd2
plot(gfevd2)
# Estimate GFEVD with fixed hand specified initial values. We use the
# unconditional mean of the process:
myvals <- rbind(mod22s$uncond_moments$uncond_mean,
mod22s$uncond_moments$uncond_mean)
gfevd3 <- GFEVD(mod22s, N=36, R1=50, initval_type="fixed",
init_values=myvals, include_mixweights=TRUE)
gfevd3
plot(gfevd3)