Skip to content

Commit

Permalink
fix for incorrect computation of n Nixtla#690
Browse files Browse the repository at this point in the history
  • Loading branch information
StatKumar committed Nov 24, 2023
1 parent 0d2a259 commit d3e07f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ nbs/.last_checked
.idea
mlruns/
.luarc.json
venv
5 changes: 3 additions & 2 deletions statsforecast/arima.py
Original file line number Diff line number Diff line change
Expand Up @@ -1481,8 +1481,9 @@ def Arima(
missing = np.isnan(tmp["residuals"])
nonmiss_idxs = np.where(~missing)[0]
firstnonmiss = np.min(nonmiss_idxs)
lastnonmiss = np.max(nonmiss_idxs)
n = np.sum(~missing[firstnonmiss:lastnonmiss])
# lastnonmiss = np.max(nonmiss_idxs)
# n = np.sum(~missing[firstnonmiss:lastnonmiss])
n = np.sum(~missing[firstnonmiss:])
nstar = n - tmp["arma"][5] - tmp["arma"][6] * tmp["arma"][4]
tmp["aicc"] = tmp["aic"] + 2 * npar * (nstar / (nstar - npar - 1) - 1)
tmp["bic"] = tmp["aic"] + npar * (math.log(nstar) - 2)
Expand Down

0 comments on commit d3e07f1

Please sign in to comment.