Skip to content

Commit

Permalink
added ... to aicTable
Browse files Browse the repository at this point in the history
  • Loading branch information
jeswheel committed Oct 10, 2023
1 parent 42c35d2 commit 19a589e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# arima2 (development version)

* Added `...` argument to `aicTable` function.

# arima2 3.0.1

* Added arXiv paper to package description
Expand Down
9 changes: 5 additions & 4 deletions R/aicTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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 = ""))
Expand Down
13 changes: 12 additions & 1 deletion man/aicTable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 19a589e

Please sign in to comment.