Reputation: 1
I am modeling daily orders with seasonality using vector auto-regressive model with exogenous variables. I used the 'vars' package which has functions to fit the model. I got predictions without using exogenous variables but I must include them. When I included them, my predictions came up as NAs. I don't understand why this is happening. My matrix of exogenous variables includes marketing information and plenty of zeros and ones. It is a 1218 x 123 size matrix. My endogenous variables is a 1218 x 4 size matrix. R code below. I really need help on how to fix this problem with my predictions.
final<-merge.zoo(regresseditems, powers, lags)
final<-as.matrix(final)
final[is.na(final)] <- 0
x1<-final[5:1222,]
vardata<-merge.zoo(Total_Orders.ts,prospects_orders.ts,house_orders.ts,
Email_Transactions.ts)
jaba<-as.matrix(vardata)
lambda <- BoxCox.lambda(na.contiguous(jaba))
VARlnorders<-BoxCox(jaba, lambda)
vardatest<-VAR(VARlnorders, p = 123 , type ="both", season =366, exogen=x1)
predictions <-predict(vardatest, n.ahead=254,dumvar=x2)
(x2 is a 254 x 123 reduced size matrix of the same exogenous variables. n.ahead must equal the number of observations in x2)
$prospects_orders.ts
fcst lower upper CI
[1,] NA NA NA 0.9641635
[2,] NA NA NA 1.1487698
[3,] NA NA NA 1.3001178
[4,] NA NA NA 1.4754121
[5,] NA NA NA 1.5504319
[6,] NA NA NA 1.6052040
[7,] NA NA NA 1.6545732
Upvotes: 0
Views: 1914
Reputation: 2874
Using the dummy variables, which are the same as the exo variables in the model may cause some problems, as I believe some of the relationships would end up incalculable.
I don't think I can answer your question completely, although looking at your model, I would say that you lag (p) is pretty huge - I would try setting it using the AIC optimal lag in the VAR-function.
Also, although your variables for the model might be quite simple, containing 0s and 1s in places, you still are stretching the abilities of such a model (and as a result the feasibility/credibility of the output) in that you have a relatively small number of observations for the number of variables.
I know that for a lot of models I have done using VAR (package: vars) that the results slowly lose significance and credibility as I added more variables. Try first doing some smaller baskets of variables that make sense together, or even doing some pairwise testing first.
If you did do this, you could try using the smaller number of variables all as endogenous variables in the VAR model too.
Upvotes: 1