Skip to content

Commit

Permalink
🐛 Small fix in model configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizFCDuarte committed Jun 10, 2024
1 parent 20b86d3 commit 4f3fb4a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
SCIP = "82193955-e24f-5292-bf16-6f2c5261a85f"
StateSpaceModels = "99342f36-827c-5390-97c9-d7f9ee765c78"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Expand All @@ -28,4 +29,4 @@ TimeSeries = "9e3dc215-6440-5c97-bce1-76c03772f85e"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["Test"]
3 changes: 1 addition & 2 deletions src/models/sarima.jl
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function fit!(model::SARIMAModel;silent::Bool=true,optimizer::DataType=Ipopt.Opt
model.keepProvidedCoefficients && setProvidedCoefficients!(mod, model)
includeSolverParameters!(mod, silent)

lb = max(model.p,model.P*model.seasonality) + 1
lb = max(model.p,model.P*model.seasonality,model.q,model.Q*model.seasonality) + 1
fix.(ϵ[1:lb-1],0.0)

if model.seasonality > 1
Expand Down Expand Up @@ -482,7 +482,6 @@ Includes the constraints in the JuMP model for the SARIMA model.
- `objectiveFunction::String`: The objective function used for optimization.
"""
function includeModelConstraints!(jumpModel::Model, yValues::Vector{Fl}, T::Int, lb::Int, objectiveFunction::String) where Fl<:AbstractFloat
@constraint(jumpModel, mean(jumpModel[]) == 0)
if objectiveFunction == "mae"
@variable(jumpModel, ϵ_plus[lb:T] >= 0)
@variable(jumpModel, ϵ_minus[lb:T] >= 0)
Expand Down
6 changes: 3 additions & 3 deletions test/fit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
airPassengersLog = log.(airPassengers)
testModel = SARIMA(airPassengersLog, 3, 0, 1; seasonality=12, P=1, D=1, Q=1)
fit!(testModel)
@test aic(testModel) -494.02295978581765
@test aicc(testModel) -493.37179699511995
@test bic(testModel) -471.6722618295862
@test aic(testModel) -494.0240480738949
@test aicc(testModel) -493.3728852831972
@test bic(testModel) -471.6733501176634
end


Expand Down
4 changes: 2 additions & 2 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@

fit!(testModel)

@test loglikelihood(testModel) 254.01147989290882
@test loglike(testModel) 254.01147989290882
@test loglikelihood(testModel) 254.01202403694745
@test loglike(testModel) 254.01202403694745
end

end

0 comments on commit 4f3fb4a

Please sign in to comment.