Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

predict.isat fails when regressor matrix (mxreg) contains more than one regressor. #57

Open
fpretis opened this issue Apr 4, 2022 · 0 comments
Assignees
Labels

Comments

@fpretis
Copy link
Collaborator

fpretis commented Apr 4, 2022

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)
@moritzpschwarz moritzpschwarz self-assigned this Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants