0

Error in VAR estimation probably in roots function of vars pachange

Dear participants , I have a data set with 16 parameters and 2515 observations. My problem is with correlation matrices. I have checked for empty cells, NAs and zeros with (Y[!is.na(Y)])

I get an error when I run the following code:

Y <- mydata in csv 
t <- nrow(Y)
k <- ncol(Y)
space <- 200 
CV <- array(NA, c(k, k, (t-space)))
colnames(CV) = rownames(CV) = colnames(Y)
for (i in 1:dim(CV)[3]) {
   var1 <- VAR(Y[i:(space+i-1),], p=nlag, type="const")
   if(any(roots(var1)>1)){ 
      CV[,,i] <- CV[,,(i-1)]
   } else {
     CV[,,i] <- gfevd(var1, n.ahead=nfore)$fevd
   }
   if (i%%500==0) {print(i)}
}

The error I get is the following:

"Error in eigen(companion) : infinite or missing values in 'x' ".

It should compute for each i and j element in k by k matrix.

Oli
  • 9,766
  • 5
  • 25
  • 46
  • 2
    Please give us a small snippet of your dataset with the dput() function. – Newl May 09 '19 at 12:22
  • I hate to be this person, but please have a look at this link of [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) . The answer is not so long, but very informative. Please insert your output as a code snippet with editing your original post. – Newl May 10 '19 at 14:17
  • ```z1<- " lnSP lnDIA FTSE100 lnCAC40 lnDAX lnHSI lnNikkei 3.790799858 3.671216248 3.516116299 3.817415591 3.461823938 3.895178119 2.876151318 3.405303312 2.928783445 3.196368852 3.017934782 2.978491109 3.48247213 2.87901523 3.620242513 2.963050217 3.341393069 3.382346293 3.537484777 3.044329497 3.307504219 3.816126874 3.233886655 3.701829162 3.38884974 3.108158141 4.073703165 3.546682974 Data <- read.table(text=zz, header = TRUE)``` – sardor mirzaev May 13 '19 at 21:09
  • updated https://stackoverflow.com/questions/56120041/vars-package-roots-command-error-in-eigencompanion-infinite-or-missing-val – sardor mirzaev May 15 '19 at 06:58

0 Answers0