The function predict.isat fails when regressor matrix (mxreg) contains more than one regressor. Specifically, it seems that predict.isat creates the out-of-sample values for the indicators only if mxreg contains a single regressor. Otherwise the out-of-sample values for indicators have to be provided manually.
set-up
set.seed(123)
y <- rnorm(100, 0, 1)
x1 <- rnorm(100, 0, 1)
x2 <- rnorm(100, 0, 1)
mx_est <- cbind(x1, x2)
colnames(mx_est) <- c("x1", "x2")
library(gets)
Works:
m1 <- isat(y[1:50], mxreg=mx_est[1:50,1], mc=TRUE, iis=TRUE, sis=TRUE, t.pval=0.05)
m1
mx_pred <- as.data.frame(mx_est[51:100,1])
names(mx_pred) <- c("mxreg")
predict.isat(m1, newmxreg=mx_pred, n.ahead=50)
Does not work:
m2 <- isat(y[1:50], mxreg=mx_est[1:50,], mc=TRUE, iis=TRUE, sis=TRUE, t.pval=0.05)
m2
mx_pred <- as.data.frame(mx_est[51:100,])
names(mx_pred) <- c("x1", "x2")
predict.isat(m2, newmxreg=mx_pred, n.ahead=50)
### Manually add indicators:
mx_pred$iis16 <- 0
mx_pred$iis18 <- 0
mx_pred$iis44 <- 0
#Now this works:
predict.isat(m2, newmxreg=mx_pred, n.ahead=50)
The function predict.isat fails when regressor matrix (mxreg) contains more than one regressor. Specifically, it seems that predict.isat creates the out-of-sample values for the indicators only if mxreg contains a single regressor. Otherwise the out-of-sample values for indicators have to be provided manually.
set-up
Works:
Does not work: