Hi @wbnicholson,
Thank you for developing this valuable package! I would really appreciate some help with the BigVAR::predict function.
Package Version: the GitHub version (1.0.7) instead of the CRAN version(1.0.6)
Data: I have a matrix of 108 quarterly time series (call it train_data). Each of them has 24 points. I also created a subset of 15 time series for testing purpose (call it sub_train_data). In addition, I added 3 season dummies.
Issue: the predict function worked fine on the sub_train_data, but threw out an error for the train_data: "Error in if (contemp) { : argument is of length zero". (As expected, the model with larger data contains more 0 coefficients, but I am not sure how that affects the predict function.)
Investigate: I focused on n.ahead=1 because I could not trace the VARXCons function to test n.ahead>1. I found that, if I create a udf directly using the source code (line 2094 of BigVARObjectClass.R), this udf can make predictions.
Questions:
the source code can work but why does it fail when I use BigVAR::predict()?
the BigVAR::predict() can work on a small data but why does it fail when I use a larger data?
I realized that it is because the virtual machine I used loads in the CRAN version of the package by default. After adding the detaching command at the beginning, I was able to switch to the GitHub version.
Hi @wbnicholson, Thank you for developing this valuable package! I would really appreciate some help with the BigVAR::predict function.
Package Version: the GitHub version (1.0.7) instead of the CRAN version(1.0.6)
Data: I have a matrix of 108 quarterly time series (call it train_data). Each of them has 24 points. I also created a subset of 15 time series for testing purpose (call it sub_train_data). In addition, I added 3 season dummies.
Model Setup:
varx_list=list()
varx_list$k = ncol(train_data) - 3 # number of equations (variables) = 111 - 3 = 108
varx_list$s = 4
lasso.var = constructModel(Y=train_data, p=4, struct='Basic', gran=c(50, 10), VARX=varx_list, RVAR=F, h=1, cv='LOO', MN=F, verbose=F, IC=T)
results=cv.BigVAR(lasso.var)
BigVAR::predict(results, n.ahead=1)
Issue: the predict function worked fine on the sub_train_data, but threw out an error for the train_data:
"Error in if (contemp) { : argument is of length zero"
. (As expected, the model with larger data contains more 0 coefficients, but I am not sure how that affects the predict function.)Investigate: I focused on n.ahead=1 because I could not trace the VARXCons function to test n.ahead>1. I found that, if I create a udf directly using the source code (line 2094 of BigVARObjectClass.R), this udf can make predictions.
Questions: