where modelling_dt_train is the time series of 3 products and modelling_x_train is an exogenous variable (which is also a time series) for the same products.
I am estimating a VAR model using the following code
library(vars)
x <- log(modelling_dt_train)
x <- x[,lapply(.SD,function(x){ifelse(is.infinite(x),0,x)})]
modelling_x_train <- log(modelling_x_train)
modelling_x_train <- modelling_x_train[,lapply(.SD,function(x){ifelse(is.infinite(x),0,x)})]
x_mat <- as.matrix(x)
dx <- x_mat
var = VAR(dx, p=p, exogen = modelling_x_train, season = 18)
So far so good, but when I want to predict the values for 12 periods using
How can the colnames(data.all)ever be equal to colnames(dumvar), since the first will contain the coefficients and the second will contain the names of the products ?
I have the following data:
where
modelling_dt_train
is the time series of 3 products andmodelling_x_train
is an exogenous variable (which is also a time series) for the same products.I am estimating a VAR model using the following code
So far so good, but when I want to predict the values for 12 periods using
predict(var, newdata = modelling_dt_test, dumvar = modelling_x_test, n.ahead = 12)
I get an error:
The
newdata
and thedumvar
that I am using are some future values of the previous same products, but further in timeHow can the
colnames(data.all)
ever be equal tocolnames(dumvar)
, since the first will contain the coefficients and the second will contain the names of the products ?