Skip to content

Commit

Permalink
✨ Add OCSB test
Browse files Browse the repository at this point in the history
WIP the code is using PyCall
  • Loading branch information
LuizFCDuarte committed Jun 11, 2024
1 parent 4f3fb4a commit 77de6a9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
SCIP = "82193955-e24f-5292-bf16-6f2c5261a85f"
Expand All @@ -29,4 +30,4 @@ TimeSeries = "9e3dc215-6440-5c97-bce1-76c03772f85e"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["Test", "JSON"]
1 change: 1 addition & 0 deletions src/Sarimax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ using SCIP
using StateSpaceModels
using Statistics
using TimeSeries
using PyCall
# using GLMNet
# using Lasso

Expand Down
2 changes: 1 addition & 1 deletion src/models/sarima.jl
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ function auto(
@assert maxQ >= 0
@assert informationCriteria ["aic","aicc","bic"]
@assert integrationTest ["kpss"]
@assert seasonalIntegrationTest ["seas","ch"]
@assert seasonalIntegrationTest ["seas","ch","ocsb"]
@assert objectiveFunction ["mae","mse","ml","bilevel"]

ModelFl = eltype(values(y))
Expand Down
9 changes: 9 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ function selectSeasonalIntegrationOrder(
return StateSpaceModels.seasonal_strength_test(y, seasonality)
elseif test == "ch"
return StateSpaceModels.canova_hansen_test(y, seasonality)
elseif test == "ocsb"
py"""
import pmdarima as pm
import numpy as np
def seasonal_diffs(ts, seasonal_period):
ts_np = np.array(ts)
return pm.arima.nsdiffs(ts_np, m=seasonal_period)
"""
return py"seasonal_diffs"(y, seasonality)
end

throw(ArgumentError("The test $test is not supported"))
Expand Down

0 comments on commit 77de6a9

Please sign in to comment.