2
$\begingroup$

I am using R vars package to implement VAR model in a multivariate time series model. I tried to run:

VAR(foo_ts, p = 6)

but I was getting this error message:

Error in solve.default(Sigma) : system is computationally singular: reciprocal condition number = 0

foo_ts is a time series data.

I have tried to adapt examples in stackexchange and stackoverflow but have not been successful in running the VAR model. I have successfully run the VAR model on other datasets but not on foo_ts. Any help will be appreciated.

$\endgroup$
5
  • $\begingroup$ Have you tried looking up the error message online? $\endgroup$ Commented Jan 28, 2020 at 7:23
  • $\begingroup$ Yes. I have looked at the message online. The answer I saw is that "It means your design matrix is not invertible". But then, I do not have clue on how to adapt the solution when using R vars package. $\endgroup$
    – William
    Commented Jan 28, 2020 at 8:46
  • $\begingroup$ No package will help you if the problem lies in the data. You need to reconsider the variables you have; some of them form a linear combination equal to a constant. To solve the problem, you could get rid of the variable(s) causing that. $\endgroup$ Commented Jan 28, 2020 at 9:47
  • $\begingroup$ @RichardHardy, my guess would be severe overfitting rather than multicollinearity here. $\endgroup$ Commented Jan 28, 2020 at 12:13
  • $\begingroup$ @ChristophHanck, yes, that must be the case. I did not inspect the data and forgot to consider this possibility. $\endgroup$ Commented Jan 28, 2020 at 12:24

1 Answer 1

3
$\begingroup$

Your time series is too short to fit that many parameters. Recall that, in a VAR(p) model \begin{equation*} x_t = d + A_1 x_{t-1} + A_2 x_{t-2} + \dots + A_p x_{t-p} + \epsilon_t, \end{equation*} each parameter matrix $A_i$ will have dimension $k\times k$, where $k$ is the number of parameters. Estimation simply procedes by OLS to each equation of the VAR model. That means you will have $1+k\times p$ parameters per equation (assuming $d$ for the deterministic component is just a constant). In your case, $p=6$ and there are $k=8$ variables (although two of these appear to be identically zero and hence not very useful).

Hence, you fit 49 coefficients for each equation, but only appear to have $n=21$ observations. As is well-known, the $X'X$ matrix of the OLS estimator will not be invertible when $n$ is smaller than the number of regressors.

$\endgroup$
3
  • $\begingroup$ I am getting a similar error message after running (VAR_reduced <- VAR(VAR_data_1, p = 1, type = "both")) summary(VAR_reduced) but with a condition number just above zero. I am only using 3 variables but have 135 observations, so I should not be overfitting. Any idea what may cause that? Maybe I should add that I only get the error message after summary $\endgroup$
    – ArOk
    Commented Jul 24, 2020 at 14:17
  • $\begingroup$ Can you post a reproducible example, perhaps as a new question? $\endgroup$ Commented Jul 25, 2020 at 7:07
  • $\begingroup$ I have but on stack overflow I assumed it would fit better there, stackoverflow.com/questions/63077895/… $\endgroup$
    – ArOk
    Commented Jul 25, 2020 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.