autovarCore (version 1.0-4)

run_var: Calculate the VAR model and apply restrictions

Description

This function calls the vars::var function to calculate the VAR model and applies restrictions if needed. We set the intercept to 1 for restricted equations because calculations go wrong otherwise (this is a bug in the vars library).

Usage

run_var(endo_matrix, exo_matrix, lag)

Arguments

endo_matrix

A numeric matrix of endogenous data.

exo_matrix

Either NULL or a numeric matrix of exogenous data.

lag

A nonnegative integer specifying the lag length of the model. Specifying 0 for the lag results in calculating a lag 1 model with all lag-1 terms restricted.

Value

A varest object with the VAR estimation result.

Examples

Run this code
# NOT RUN {
endo_matrix <- matrix(rnorm(120), ncol = 2, nrow = 60,
                      dimnames = list(NULL, c("rumination", "activity")))
autovarCore:::run_var(endo_matrix, NULL, 1)
# }

Run the code above in your browser using DataCamp Workspace