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_rolling does not handle exogenous variables #18

Open
MatthieuStigler opened this issue May 14, 2020 · 0 comments
Open

predict_rolling does not handle exogenous variables #18

MatthieuStigler opened this issue May 14, 2020 · 0 comments
Labels

Comments

@MatthieuStigler
Copy link
Owner

predict_rolling does not work with exogenous variables: this is because predict_rolling_1step.nlVar only retrieves the endogenous ones: origSerie <- object$model[,1:k].

Now this will be complicated:

  1. Need to extract position of exo in object$model[,1:k], no easy way so far
  2. object$model returns exo with NAs (check: head(VECM_Exo$model))... maybe problem
  3. exos need to be fed also as exoPred in predict.nlar...
library(tsDyn)
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
data("barry")
barry_pre <- barry[1:300,]
barry_post <- barry[301:324,]

VECM_noExo <- tsDyn::VECM(barry_pre[,1:2],2, r=1,c("none"), beta=NULL,estim = "ML", c("none"))
ok <- predict_rolling(VECM_noExo,nroll= 18, refit.every = 0, n.ahead = 18, newdata=barry_post[,1:2] )

VECM_Exo <- tsDyn::VECM(barry_pre[,1:2],2, r=1,c("none"), beta=NULL,estim = "ML", c("none"), barry_pre[,3])
predict_rolling(VECM_Exo, nroll= 18, refit.every = 0, n.ahead = 18, newdata=barry_post)
#> Error in rbind(origSerie, newdata): number of columns of matrices must match (see arg 2)

Created on 2020-05-14 by the reprex package (v0.3.0)

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

1 participant