From 19a589ecad48c884950d5773e2191f606cc402ad Mon Sep 17 00:00:00 2001 From: Jesse Wheeler Date: Tue, 10 Oct 2023 10:50:01 -0400 Subject: [PATCH] added ... to aicTable --- DESCRIPTION | 2 +- NEWS.md | 2 ++ R/aicTable.R | 9 +++++---- man/aicTable.Rd | 13 ++++++++++++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8ad3506..8968925 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: arima2 Title: Likelihood Based Inference for ARIMA Modeling -Version: 3.0.1.9000 +Version: 3.0.1.9001 Authors@R: c( person("Jesse", diff --git a/NEWS.md b/NEWS.md index 1358a04..6630dc1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # arima2 (development version) +* Added `...` argument to `aicTable` function. + # arima2 3.0.1 * Added arXiv paper to package description diff --git a/R/aicTable.R b/R/aicTable.R index 5aac5a5..b09d541 100644 --- a/R/aicTable.R +++ b/R/aicTable.R @@ -25,13 +25,14 @@ #' @param eps_tol Tolerance for accepting a new solution to be better than a #' previous solution. The default corresponds to a one ten-thousandth #' unit increase in log-likelihood. +#' @param ... Additional arguments passed to [arima()]. #' #' @returns A matrix containing the model AIC values. #' @export #' @examples #' set.seed(654321) #' aicTable(presidents, 3, 2) -aicTable <- function(data, P, Q, D = 0, max_repeats = 10, max_iters = 100, eps_tol = 1e-4){ +aicTable <- function(data, P, Q, D = 0, max_repeats = 10, max_iters = 100, eps_tol = 1e-4, ...){ if (!is.numeric(P) | !is.numeric(Q) | !is.numeric(D)) { stop("'P', 'Q' and 'D' must be numeric.") @@ -42,9 +43,9 @@ aicTable <- function(data, P, Q, D = 0, max_repeats = 10, max_iters = 100, eps_t D <- as.integer(D) table <- matrix(NA, (P + 1), (Q + 1)) - for(p in 0:P) { - for(q in 0:Q) { - table[p + 1, q + 1] <- arima(data, order = c(p, D, q), max_iters = max_iters)$aic + for (p in 0:P) { + for (q in 0:Q) { + table[p + 1, q + 1] <- arima(data, order = c(p, D, q), max_iters = max_iters, ...)$aic } } dimnames(table) <- list(paste("AR", 0:P, sep = ""), paste("MA", 0:Q, sep = "")) diff --git a/man/aicTable.Rd b/man/aicTable.Rd index 212c959..158be5c 100644 --- a/man/aicTable.Rd +++ b/man/aicTable.Rd @@ -4,7 +4,16 @@ \alias{aicTable} \title{ARIMA AIC table} \usage{ -aicTable(data, P, Q, D = 0, max_repeats = 10, max_iters = 100, eps_tol = 1e-04) +aicTable( + data, + P, + Q, + D = 0, + max_repeats = 10, + max_iters = 100, + eps_tol = 1e-04, + ... +) } \arguments{ \item{data}{a time series object, or a dataset that can be used as input into @@ -32,6 +41,8 @@ so by more than \code{eps_tol}.} \item{eps_tol}{Tolerance for accepting a new solution to be better than a previous solution. The default corresponds to a one ten-thousandth unit increase in log-likelihood.} + +\item{...}{Additional arguments passed to \code{\link[=arima]{arima()}}.} } \value{ A matrix containing the model AIC values.