Skip to contents

Plots the result of a irf call.

Usage

ggvar_irf(
  x,
  series_imp = NULL,
  series_resp = NULL,
  n.ahead = 10,
  ci = 0.95,
  args_line = list(),
  args_hline = list(yintercept = 0),
  args_ribbon = list(fill = NA, linetype = 2, color = "blue"),
  args_labs = list(),
  args_facet = list(),
  facet_type = "ggplot",
  ...
)

Arguments

x

A "varest" object to pass to irf, or, directly, a "varirf" object.

series_imp

A character vector with variables to consider for the impulses. Defaults to all (NULL).

series_resp

A character vector with variables to consider for the responses. Defaults to all (NULL).

n.ahead

An integer. The size of the forecast horizon, passed to irf. Unused if x is of class varirf.

ci

The confidence level for the confidence interval. Set to FALSE to omit. Used in irf.

args_line, args_hline, args_ribbon

Additional arguments passed to geom_line, geom_hline, and geom_ribbon (respectively). See more in the 'Customization' section.

args_labs

Additional arguments passed to labs. If an empty list, will be changed to default values.

args_facet

Additional arguments passed to the faceting engine used.

facet_type

The facet 'engine' to be used. 'ggplot2' for ggplot2::facet_grid, 'ggh4x' for ggh4x::facet_grid2.

...

Arguments passed to methods, see the 'Methods' section.

Value

A ggplot.

Details

Customization

The graph can be customized both with the 'static' arguments passed to each layer – using the args_* arguments –, and, if applicable, the 'dynamic' aesthetics – using the args_aes argument.

After built, the result can be further customized as any ggplot, adding or overwriting layers with the ggplot's +. It is useful to understand the data and the mappings coded by the package, using the function get_gg_info.

See vignette('customizing-graphs') for more details.

Methods

The data from x is extracted with the generic function texts_vec. Each class conditions an external function to pass the ... arguments to. Below there is a list with all the currently implemented classes:

  • Class 'varest': passed to vars::irf.

  • Class 'varirf': passed to nothing.

See also

Other VAR output plots: ggvar_fevd()

Examples

ggvar_irf(vars::VAR(freeny[-2]), args_facet = list(scales = "free_y"))