r - Howto fix my VAR model predictions? -


i modeling daily orders seasonality using vector auto-regressive model exogenous variables. used 'vars' package has functions fit model. got predictions without using exogenous variables must include them. when included them, predictions came nas. don't understand why happening. matrix of exogenous variables includes marketing information , plenty of zeros , ones. 1218 x 123 size matrix. endogenous variables 1218 x 4 size matrix. r code below. need on how fix problem 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 254 x 123 reduced size matrix of same exogenous variables. n.ahead must equal 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 

using dummy variables, same exo variables in model may cause problems, believe of relationships end incalculable.

i don't think can answer question completely, although looking @ model, lag (p) pretty huge - try setting using aic optimal lag in var-function.

also, although variables model might quite simple, containing 0s , 1s in places, still stretching abilities of such model (and result feasibility/credibility of output) in have relatively small number of observations number of variables.

i know lot of models have done using var (package: vars) results lose significance , credibility added more variables. try first doing smaller baskets of variables make sense together, or doing pairwise testing first.
if did this, try using smaller number of variables endogenous variables in var model too.


Comments