From e07fc921bb717533c57e0bced983ad66fe0c3273 Mon Sep 17 00:00:00 2001 From: Tim Ginker Date: Sun, 26 Jan 2025 14:26:58 +0200 Subject: [PATCH] added custom arguments to arima --- R/generic_functions.R | 25 +++++++++++++++++-------- man/predict.boiwsa.Rd | 6 ++++-- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/R/generic_functions.R b/R/generic_functions.R index 8a9aedb..238a412 100644 --- a/R/generic_functions.R +++ b/R/generic_functions.R @@ -131,29 +131,38 @@ plot.boiwsa=function(x,...){ #' @param n.ahead Number of periods for forecasting #' @param level Confidence level for prediction intervals #' @param new_H Matrix with holiday- and trading day factors +#' @param arima.options List of forecast::Arima arguments, intended for users who wish to apply a custom a custom model. #' @param ... Other arguments #' -#' @return Matrix with the forecast values +#' @return Matrix with the forecast values and ARIMA fit #' #' @export #' predict.boiwsa<-function(x, - n.ahead, - level=c(80, 95), - new_H=NULL,...){ + n.ahead, + level=c(80, 95), + new_H=NULL, + arima.options=NULL, + ...){ # fitting auto.arima to seasonally- and outlier adjusted variables if(length(x$ao.list)>0){ - y_est=x$sa-x$out.factors + y_est<-x$sa-x$out.factors }else{ - y_est=x$sa + y_est<-x$sa } - fit=forecast::auto.arima(y_est, - seasonal = F) + + if(is.null(arima.options)){ + + fit<-forecast::auto.arima(y_est, + seasonal = F)}else{ + + fit<-do.call(forecast::Arima,c(list(y=y_est),arima.options)) + } # forecasting sa sereies n.ahead periods forward diff --git a/man/predict.boiwsa.Rd b/man/predict.boiwsa.Rd index c15b9ff..795ca15 100644 --- a/man/predict.boiwsa.Rd +++ b/man/predict.boiwsa.Rd @@ -4,7 +4,7 @@ \alias{predict.boiwsa} \title{Forecast} \usage{ -\method{predict}{boiwsa}(x, n.ahead, level = c(80, 95), new_H = NULL, ...) +\method{predict}{boiwsa}(x, n.ahead, level = c(80, 95), new_H = NULL, arima.options = NULL, ...) } \arguments{ \item{x}{An object of class \code{boiwsa}.} @@ -15,10 +15,12 @@ \item{new_H}{Matrix with holiday- and trading day factors} +\item{arima.options}{List of forecast::Arima arguments, intended for users who wish to apply a custom a custom model.} + \item{...}{Other arguments} } \value{ -Matrix with the forecast values +Matrix with the forecast values and ARIMA fit } \description{ S3 method for boiwsa. Returns forecasts and other information using a combination of nonseasonal