GFEVD: Estimate generalized forecast error variance decomposition...

Description Usage Arguments Details Value Methods (by generic) References See Also Examples

View source: R/GIRFandGFEVD.R

Description

GFEVD estimates generalized generalized forecast error variance decomposition for a structural GMVAR, StMVAR, or G-StMVAR model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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 'gsmvar', typically created with fitGSMVAR or GSMVAR.

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?

"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 mth regime. Ignored if the argument init_values is specified.

init_values

a size (pxd) matrix specifying the initial values, where d is the number of time series in the system. The last row will be used as initial values for the first lag, the second last row for second lag etc. If not specified, initial values will be drawn according to mixture distribution specifed by the argument init_regimes.

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.

Details

The model needs to be structural in order for this function to be applicable. A structural GMVAR, StMVAR, or G-StMVAR model can be estimated by specifying the argument structural_pars in the function fitGSMVAR.

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

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)

References

See Also

GIRF, fitGSMVAR, GSMVAR, gsmvar_to_sgsmvar, reorder_W_columns, swap_W_signs, simulate.gsmvar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
 # 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 <- 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.

 ## 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)
 

saviviro/gmvarkit documentation built on Oct. 25, 2021, 2:14 a.m.