Automated Vector Autoregression Models and Networks

Automatically find the best vector autoregression models and networks for a given time series data set. 'AutovarCore' evaluates eight kinds of models: models with and without log transforming the data, lag 1 and lag 2 models, and models with and without weekday dummy variables. For each of these 8 model configurations, 'AutovarCore' evaluates all possible combinations for including outlier dummies (at 2.5x the standard deviation of the residuals) and retains the best model. Model evaluation includes the Eigenvalue stability test and a configurable set of residual tests. These eight models are further reduced to four models because 'AutovarCore' determines whether adding weekday dummies improves the model fit.

Circle CI

AutovarCore finds the best fitting VAR models for a given time series data set that pass the selected set of residual assumptions. AutovarCore will also generate Granger causality networks given a data frame (this functionality is not yet implemented). AutovarCore is a simplified/efficient version of Autovar.

To install, type the following:


For more information on Autovar, see Help documentation for AutovarCore can be found on

You should use Autovar if you

  • Prefer a slightly better model fit over a model with less outlier dummies (less outlier dummies means that the model explains more of the measurements).
  • Are okay with Autovar sometimes returning NULL because it could not find any models that passed all residual tests.
  • Need VAR models with more than one lag or with zero lags.
  • Need models with automatically determined restrictions.
  • Need debugging information such as a full list of all evaluated models.
  • Want detailed summary information such as a plot of contemporaneous correlations or Granger causalities.
  • Need named dummy variables for interpretation (e.g., "morning", "afternoon", "Monday", "Tuesday" instead of "day_part_1", "day_part_1", "day_3", "day_4")

You should use AutovarCore if you

  • Prefer a model with less outlier dummies over a model with a slightly better model fit (less outlier dummies means that the model explains more of the measurements).
  • Always want a list of best models even if those do not pass all residual tests at the default p-level (this is indicated by the 'bucket' property, see ?autovar for details).
  • Are not interested in any models except for models with lag 1 and models with lag 2 where the second lag is autoregressive only.
  • May have missing data (i.e., NA values). Autovar also has a function "impute_dataframe" to impute values, but AutovarCore does this automatically (if needed).
  • Need more flexibility as to which residual tests should constitute model validity (e.g., portmanteau, portmanteau_squared, skewness, kurtosis, joint_sktest). Autovar uses a fixed set of residual tests.
  • Deem performance to be an issue and prefer memory-efficient and fast code.

Example use


# AutovarCore requires input data in data.frame format.
# If you have data in a .csv, .dta, or .sav file, use
# the 'foreign' library to load this data into R first.
# (You may need to type:
#    install.packages('foreign')
#  if you do not have the foreign library installed on
#  your system.)

# This example data set can be downloaded from
suppressWarnings(dfile <- read.spss('~/Downloads/aug_pp5_da.sav'))
dframe <- data.frame(Activity = dfile$Activity, Depression = dfile$Depression)

# Call autovar with the given data frame. Type:
#   ?autovar
# (after having typed "library('autovarCore')") to see 
# which other options are available.
models_found <- autovar(dframe, selected_column_names = c('Activity', 'Depression'))

# Show details for the best model found


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.0-4 by Ando Emerencia, 2 years ago

Report a bug at

Browse source code at

Authors: Ando Emerencia [aut, cre]

Documentation:   PDF Manual  

Task views:

MIT + file LICENSE license

Imports Rcpp, Amelia, jsonlite, parallel, stats, urca, vars

Suggests testthat, roxygen2

Linking to Rcpp

See at CRAN