fevd.bvar {bvartools} | R Documentation |
Forecast Error Variance Decomposition
Description
Produces the forecast error variance decomposition of a Bayesian VAR model.
Usage
## S3 method for class 'bvar'
fevd(
object,
response = NULL,
n.ahead = 5,
type = "oir",
normalise_gir = FALSE,
period = NULL,
...
)
Arguments
object |
an object of class |
response |
name of the response variable. |
n.ahead |
number of steps ahead. |
type |
type of the impulse responses used to calculate forecast error variable decompositions.
Possible choices are orthogonalised |
normalise_gir |
logical. Should the GIR-based FEVD be normalised? |
period |
integer. Index of the period, for which the variance decomposition should be generated.
Only used for TVP or SV models. Default is |
... |
further arguments passed to or from other methods. |
Details
The function produces forecast error variance decompositions (FEVD) for the VAR model
with . For non-structural models matrix
is set to the identiy matrix
and can therefore be omitted, where not relevant.
If the FEVD is based on the orthogonalised impulse resonse (OIR), the FEVD will be calculated as
where is the forecast error impulse response for the
th period,
is the lower triangular Choleski decomposition of the variance-covariance
matrix
,
is a selection vector for the response variable and
a selection vector for the impulse variable.
If type = "sir"
, the structural FEVD will be
calculated as
where is the diagonal element of the
th variable of the variance covariance matrix.
If type = "gir"
, the generalised FEVD will be
calculated as
where is the diagonal element of the
th variable of the variance covariance matrix.
If type = "sgir"
, the structural generalised FEVD will be
calculated as
.
Since GIR-based FEVDs do not add up to unity, they can be normalised by setting normalise_gir = TRUE
.
Value
A time-series object of class "bvarfevd"
.
References
Lütkepohl, H. (2006). New introduction to multiple time series analysis (2nd ed.). Berlin: Springer.
Pesaran, H. H., & Shin, Y. (1998). Generalized impulse response analysis in linear multivariate models. Economics Letters, 58, 17-29.
Examples
# Load data
data("e1")
e1 <- diff(log(e1)) * 100
# Generate models
model <- gen_var(e1, p = 2, deterministic = 2,
iterations = 100, burnin = 10)
# Add priors
model <- add_priors(model)
# Obtain posterior draws
object <- draw_posterior(model)
# Obtain FEVD
vd <- fevd(object, response = "cons")
# Plot FEVD
plot(vd)