1

I am building a vector autoregressive model and got stuck on some problem. My regressors are some sentiment and financial values. For testing robustness I wanted to add multiple other economic variables to the model.

The problem I encounter is: when adding a fourth regressor I only get an error message in R. I can use three from any combination, but as soon as I add a fourth one, it wont work (see error message below)...

My Code:

library(dplyr)
library(readr)
library(tidyverse)
library(urca)
library(vars)
library(tseries)
library(forecast)
library(stargazer)

tr <- ts(TR$tr, start = c(2011, 1), frequency = 4) #4 because quarterly

Index1 <- ts(Index1$Value, start = c(2011, 1), frequency = 4)
Index2 <- ts(Index2$Value, start = c(2011, 1), frequency = 4)
Control1 <- ts(CPI$Value, start = c(2011, 1), frequency = 4)
Control2 <- ts(Spread$Value, start = c(2011, 1), frequency = 4)

# for finding optimal lags

tr.bv <- cbind(TR$tr, Index1$Value, Index2$Value, CPI$Value, Spread$Value)
colnames(tr.bv) <- cbind("Total Return", "Index1", "Index2", "CPI", "Spread")

lagselect <- VARselect(tr.bv, lag.max = 10, type = "const")
lagselect$selection

# Building the model

Model <- VAR(tr.bv, p = 10, type = "const", season = NULL, exog = NULL)

summary(Model_LSTM)

The error message I get:

Error in solve.default(Sigma) : 
  Lapack routine dgesv: system is exactly singular: U[1,1] = 0

In addition: Warning message:
In cor(resids) : Standarddeviation equals zero

I did build the same model in Python using the statsmodel VAR function -> here I only get 0's as p-values or nan's...

Hopefully someone can help me?

Schlaeggi
  • 35
  • 5
  • What is really helpful in proiding a minimal reproducable example is to remove all the code and page loading that have no relationship to the question. You are not using library(dplyr) library(readr) library(tidyverse) at least. Also where does TR come from? – Elin Oct 22 '22 at 20:38

1 Answers1

0

The problem likely lies with your data and the final parameter you have added to your model (possibly multicollinearity or overfitting). A reproducible example would be helpful here.

See: https://stats.stackexchange.com/questions/446707/var-model-error-in-solve-defaultsigma-system-is-computationally-singular-r

br00t
  • 1,440
  • 8
  • 10