Skip to content

Commit

Permalink
Change default VARIMA identification to "none" when p&q are fully spec
Browse files Browse the repository at this point in the history
Ref #421
  • Loading branch information
mitchelloharawild committed Nov 28, 2024
1 parent 8d67360 commit 5337ff7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions R/VARIMA.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
train_varima <- function(.data, specials, identification, ...) {
train_varima <- function(.data, specials, identification = NULL, ...) {
# Get response variables
y <- invoke(cbind, lapply(unclass(.data)[measured_vars(.data)], as.double))

Expand All @@ -12,6 +12,14 @@ train_varima <- function(.data, specials, identification, ...) {

yd <- if(d > 0) diff(y, differences = d) else y

if (is.null(identification)) {
identification <- if ((length(p) != 1) || (length(q) != 1)) {
"kronecker_indices"
} else {
"none"
}
}

require_package("MTS")
utils::capture.output(
fit <- if (identification == "kronecker_indices") {
Expand Down Expand Up @@ -130,8 +138,7 @@ specials_varima <- new_specials(
#'
#' fit
#' @export
VARIMA <- function(formula, identification = c("kronecker_indices", "none"), ...) {
identification <- match.arg(identification)
VARIMA <- function(formula, identification = NULL, ...) {
# ic <- switch(ic, aicc = "AICc", aic = "AIC", bic = "BIC")
varima_model <- new_model_class("VARIMA",
train = train_varima,
Expand All @@ -143,6 +150,7 @@ VARIMA <- function(formula, identification = c("kronecker_indices", "none"), ...
}

varima_order <- function(x) {
if(is.null(x)) return(0L)
NCOL(x)/NROW(x)
}

Expand Down
2 changes: 1 addition & 1 deletion man/VARIMA.Rd

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

0 comments on commit 5337ff7

Please sign in to comment.