Skip to content

Commit a13f5d2

Browse files
committed
Fix d and D order selection
1 parent c581461 commit a13f5d2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/models/sarima.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -939,8 +939,15 @@ function auto_arima(y::Vector{Fl};
939939
@assert integration_test in ["kpss"]
940940
@assert seasonal_integration_test in ["seas", "ch"]
941941

942-
D = seasonal != 0 && D <= 0 ? select_seasonal_integration_order(y, seasonal, seasonal_integration_test) : D
943-
d = d <= 0 ? select_integration_order(y, max_d, D, seasonal, integration_test) : d
942+
if seasonal == 0
943+
D = 0
944+
elseif D < 0 # select automatically
945+
D = select_seasonal_integration_order(y, seasonal, seasonal_integration_test)
946+
end # D was fixed
947+
948+
if d < 0 # select automatically
949+
d = select_integration_order(y, max_d, D, seasonal, integration_test)
950+
end
944951

945952
include_mean = allow_mean && (d + D < 2)
946953
show_trace && println("Model specification Selection metric")

0 commit comments

Comments
 (0)