Closed MatthieuStigler closed 4 years ago
Get:
#> Warning: tail(., addrownums = V) is deprecated. #> Use tail(., keepnums = V) instead.
library(tsDyn) #> Registered S3 method overwritten by 'quantmod': #> method from #> as.zoo.data.frame zoo packageVersion("tsDyn") #> [1] '0.9.48.999' exogen1<-rnorm(120,0,10) exogen2<-rnorm(120,0,10) dc <- rep(0, 120) dc[60:80] <- 1 #dummy variable representation x<-rnorm(120,0,10) y<-rnorm(120,0,15) i<-1:120 x1<-sapply(i,function(k) sum(x[1:k])) x2<-x1+y endogen<-cbind(x1,x2) exogen<- cbind(exogen1, exogen2, dc) mdl<- VECM(endogen, lag=1, estim = "ML", r=1, exogen = exogen) #> Warning: tail(., addrownums = V) is deprecated. #> Use tail(., keepnums = V) instead. new_endogen <-tail(cbind(x1,x2),24) new_exogen <- tail(cbind(exogen1,exogen2,dc),24) predict(mdl, newdata=new_endogen[1,,drop=FALSE], exoPred = new_exogen, n.ahead=24) #> Error in predict.VAR(mdl, newdata = new_endogen[1, , drop = FALSE], exoPred = new_exogen, : Please provide newdata with nrow=lag
Created on 2020-09-28 by the reprex package (v0.3.0)
fixed with update
Get:
Created on 2020-09-28 by the reprex package (v0.3.0)