Learn R Programming

gmvarkit (version 1.5.0)

GFEVD: Estimate generalized forecast error variance decomposition for a structural GMVAR model.

Description

GFEVD estimates generalized generalized forecast error variance decomposition for a structural GMVAR model.

Usage

GFEVD(
  gmvar,
  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 gfevd plot(x, ...)

# S3 method for gfevd print(x, ..., digits = 2, N_to_print)

Arguments

gmvar

an object of class 'gmvar' created with fitGMVAR or GMVAR.

shock_size

What shocks size should be used for all shocks? By the definition of the SGMVAR 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?

"data":

Estimate the GIRF for all the possible length \(p\) histories in the data.

"random":

Estimate the GIRF for several random initial values generated from the stationary distribution of the process or from the stationary distribution of specific regime(s) chosen with the argument init_regimes. The number of initial values is set with the argument R2.

"fixed":

Estimate the GIRF for a fixed initial value only, which is specified with the argument init_values.

R1

the number of repetitions used to estimate GIRF for each initial value.

R2

the number of initial values to be drawn if initval_type="random".

init_regimes

a numeric vector of length at most \(M\) and elements in \(1,...,M\) specifying the regimes from which the initial values should be generated from. The initial values will be generated from a mixture distribution with the mixture components being the stationary distributions of the specific regimes and the (proportional) mixing weights given by the mixing weight parameters of those regimes. Note that if init_regimes=1:M, the initial values are generated from the stationary distribution of the process and if init_regimes=m, the initial value are generated from the stationary distribution of the \(m\)th regime. Ignored if init_value is specified.

init_values

a matrix or a multivariate class 'ts' object with \(d\) columns and at least \(p\) rows specifying an initial value for the GIRF. The last \(p\) rows are taken to be the initial value assuming that the last row is the most recent observation.

which_cumulative

a numeric vector with values in \(1,...,d\) (d=ncol(data)) specifying which the variables for which the impulse responses should be cumulative. Default is none.

include_mixweights

should the GFEVD be estimated for the mixing weights as well? Note that this is ignored if M=1 and if M=2 the GFEVD will be the same for both regime's mixing weights.

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...

  • ...nrow(data) - p + 1 if initval_type="data".

  • ...R2 if initval_type="random".

  • ...1 if initval_type="fixed.".

Set to NULL for not initializing the seed. Exists for creating reproducible results.

x

object of class 'gfevd' generated by the function GFEVD.

...

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.

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.

Methods (by generic)

  • plot: plot method

  • print: print method

Details

The model needs to be structural in order for this function to be applicable. A structural GMVAR model can be estimated by specifying the argument structural_pars in the function fitGMVAR.

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 (2020).

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. 2020. Structural Gaussian mixture vector autoregressive model. Unpublished working paper, available as arXiv:2007.04713.

See Also

GIRF, fitGMVAR, GMVAR, gmvar_to_sgmvar, reorder_W_columns, swap_W_signs, simulateGMVAR

Examples

Run this code
# NOT RUN {
 
# }
# NOT RUN {
 # These are long-running examples that use parallel computing.
 # It takes approximately 30 seconds to run all the below 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 <- GMVAR(gdpdef, p=2, M=2, params=params22s,
  structural_pars=list(W=W_22))
 mod22s
 # Alternatively, use:
 #fit22s <- fitGMVAR(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.

 ## NOTE: Use larger R1 is empirical applications! Small R1 is used
 ## Below only to fasten the execution time of the examples.

 # Estimating the GFEVD using all possible histories in the data as the
 # initial values:
 gfevd1 <- GFEVD(mod22s, N=24, R1=20, 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=20, 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)
 
# }

Run the code above in your browser using DataLab