Skip to contents

Plots the result of a call to VARselect.

Usage

ggvar_select(
  x,
  series = NULL,
  lag.max = 10,
  type = "const",
  criteria = c("AIC", "HQ", "SC", "FPE"),
  trans = "none",
  args_aes = list(),
  args_line = list(),
  args_labs = list(),
  ...
)

Arguments

x

A dataset (object coercible to data.frame) to pass to VARselect, or, directly, a result of such call.

series

A character vector with series (variables) to consider. Defaults to all (NULL).

lag.max

Integer for the highest lag order. Passed to VARselect. Unused if x is of class list.

type

Type of deterministic regressors to include. Passed to VARselect. Unused if x is of class list.

criteria

The criteria to be considered. Any of "AIC", "HQ", "SC", and "FPE".

trans

A transformation to apply to each criteria result (vector). Can be a function, "none" (the default), or "index" to create index numbers.

args_aes

Defines aesthetics to differentiate the data. A named list of aesthetics names (*) – arguments passed to ggplot2::scale_*_manual. See more in the 'Customization' section.

args_line

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

args_labs

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

...

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.

The args_aes is a list with '* = arguments to scale_*_manual \ elements, where '*' represents the name of an aesthetic to apply to the \ data. View vignette('ggplot2-specs', 'ggplot2') to see the available \ aesthetics.

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 'list': passed to nothing.

  • Class 'default': passed to vars::VARselect.

See also

Other model diagnostics plots: ggvar_acf(), ggvar_dispersion(), ggvar_distribution(), ggvar_history(), ggvar_stability()

Examples

ggvar_select(vars::VARselect(freeny[-2]))
#> lag.max is unused if `x` is of class list.
#> type is unused if `x` is of class list.
#> Warning: Some aesthetic must have its 'values' defined in `args_aes`. Setting
#> `args_aes$color$values` to "'ggplot'".