fevd: Forecast error variance decomposition

View source: R/fevd.R

fevdR Documentation

Forecast error variance decomposition

Description

Splits the forecast error variance of each variable at each horizon into the contributions of the structural shocks — "how much of inflation uncertainty two years out is the cost-push shock?". For

x_t = P x_{t-1} + Q e_t, e_t ~ N(0, S)

the h-step forecast error variance is

V_h = sum_{j<h} P^j Q S Q' (P^j)'

and the share of shock k is the same sum with only column k of Q active. Shares sum to one across shocks for every variable and horizon.

Usage

fevd(x, ...)

## S3 method for class 'qpm_solution'
fevd(x, horizon = 24, vars = NULL, shocks = NULL, ...)

## S3 method for class 'qpm_fevd'
plot(x, var = NULL, drop_zero = TRUE, ...)

Arguments

x

A qpm_solution, or a qpm_model (solved first).

...

Passed to methods.

horizon

Largest forecast horizon.

vars

Variables to include; default all declared variables.

shocks

Shocks to include; default all.

var

Variable to plot.

drop_zero

Omit shocks that never contribute.

Details

Shares remain well defined when the model has unit roots, even though the variances themselves grow without bound.

Value

A data frame of class qpm_fevd in long format with columns variable, shock, horizon, share and variance. print() shows the dominant shocks; plot() draws stacked shares.

Examples

sol <- qpm_solve(qpm_template("bkl"))
fv <- fevd(sol, horizon = 20)
fv
plot(fv, var = "pi")

qpmR documentation built on Sept. 29, 2026, 5:10 p.m.