Skip to content

Commit

Permalink
Fix to innov argument passed to predict
Browse files Browse the repository at this point in the history
Was set to NULL. Now correctly takes the argument and passes it to the simulation method.
  • Loading branch information
alexiosg committed Jun 28, 2024
1 parent 85ec7bd commit d8a5278
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: tsarma
Type: Package
Title: Univariate ARMA Models
Version: 0.1.0
Version: 0.2.0
Author: Alexios Galanos
Maintainer: alexios galanos <[email protected]>
Depends: R (>= 3.5.0), methods, tsmethods
Expand Down
5 changes: 5 additions & 0 deletions R/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,11 @@ tsfilter.tsarma.spec <- function(object, y = NULL, newxreg = NULL, ...)
#'
predict.tsarma.estimate <- function(object, h = 1, newxreg = NULL, bootstrap = FALSE, nsim = 1000, innov = NULL, innov_type = "r", innov_init = NULL, forc_dates = NULL, series_init = NULL, ...)
{
if (!is.null(innov)) {
if (!is.matrix(innov)) stop("\ninnov must be a matrix of size nsim x h")
if (NROW(innov) != nsim) stop("\nNROW(innov) must be equal to nsim")
if (NCOL(innov) != h) stop("\nNCOL(innov) must be equal to h")
}
model <- object$spec$model$model
p <- .predict_arma(object = object, h = h, newxreg = newxreg, bootstrap = bootstrap, nsim = nsim, innov = innov, innov_type = innov_type,
innov_init = innov_init, forc_dates = forc_dates, series_init = series_init)
Expand Down
2 changes: 1 addition & 1 deletion R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
innov <- matrix(sample(as.numeric(residuals(object)), nsim * h, replace = TRUE), nrow = nsim, ncol = h)
sim <- simulate(object, h = h, nsim = nsim, innov = innov, innov_init = innov_init, series_init = series_init, innov_type = "r")
} else {
sim <- simulate(object, h = h, nsim = nsim, innov = NULL, innov_init = innov_init, series_init = series_init)
sim <- simulate(object, h = h, nsim = nsim, innov = innov, innov_type = innov_type, innov_init = innov_init, series_init = series_init)
}
sim <- sim$simulated
colnames(sim) <- as.character(forc_dates)
Expand Down

0 comments on commit d8a5278

Please sign in to comment.