Skip to content

Commit

Permalink
Added var check
Browse files Browse the repository at this point in the history
  • Loading branch information
jeswheel committed Oct 26, 2023
1 parent 312e490 commit bb49d37
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 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.3.9000
Version: 3.0.4.9000
Authors@R:
c(
person("Jesse",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# arima2 (development version)

# arima2 3.0.4

* Added a check to ensure a random restart is considered an improvement only if it returns a model that has a proper variance matrix for estimated coefficients.

# arima2 3.0.3

* Added `aicc` option to `aicTable`, and removed superfluous arguments.
Expand Down
7 changes: 6 additions & 1 deletion R/arima.R
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,12 @@ arima <- function(x, order = c(0L, 0L, 0L),
) # End trycatch
)

if (restart_result$error == 0 && restart_result$i_value + (eps_tol * 2) < best_value) {
# Make sure the best fit also has a proper covariant matrix for coefficients.
suppressWarnings(
inv_test <- !is.null(restart_result$i_var) && !any(is.nan(sqrt(diag(restart_result$i_var))))
)

if (restart_result$error == 0 && restart_result$i_value + (eps_tol * 2) < best_value && inv_test) {
best_coef <- restart_result$i_coef
best_res <- restart_result$i_res
best_var <- restart_result$i_var
Expand Down

0 comments on commit bb49d37

Please sign in to comment.