Displaying 1 result from an estimated 1 matches for "training_matrix".
2010 Feb 07
1
Out-of-sample prediction with VAR
...#39;t it at least predict just as well as the
simple AR(3) by finding that the extra variables have no added value?
My code:
ts_Y <- ts(log_residuals[1:104]); # detrended sales data
ts_XGG <- ts(salesmodeldata$gtrends_global[1:104]);
ts_XGL <- ts(salesmodeldata$gtrends_local[1:104]);
training_matrix <- data.frame(ts_Y, ts_XGG, ts_XGL);
### Try VAR(3)
var_model <- VAR (y=training_matrix, p=3, type="both", season=NULL,
exogen=NULL, lag.max=NULL);
## Out of sample forecasting
var.lm = lm(var_model$varresult$ts_Y); # the generated LM
ts_Y <- ts(log_residuals[105:155]...