Skip to content

Commit

Permalink
🐛 Fix drift implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizFCDuarte committed Jun 11, 2024
1 parent 25be5a7 commit 557146e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/models/sarima.jl
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ function fit!(model::SARIMAModel;silent::Bool=true,optimizer::DataType=Ipopt.Opt
fix.(ϵ[1:lb-1],0.0)

if model.seasonality > 1
@expression(mod, ŷ[t=lb:T], c + trend*t + sum(β[i]*exogValues[t,i] for i=1:nExog) + sum(ϕ[i]*yValues[t - i] for i=1:model.p) + sum(θ[j]*ϵ[t - j] for j=1:model.q if (t-j > 0)) + sum(Φ[k]*yValues[t - (model.seasonality*k)] for k=1:model.P) + sum(Θ[w]*ϵ[t - (model.seasonality*w)] for w=1:model.Q if (t - (model.seasonality*w) > 0)))
@expression(mod, ŷ[t=lb:T], c + trend + sum(β[i]*exogValues[t,i] for i=1:nExog) + sum(ϕ[i]*yValues[t - i] for i=1:model.p) + sum(θ[j]*ϵ[t - j] for j=1:model.q if (t-j > 0)) + sum(Φ[k]*yValues[t - (model.seasonality*k)] for k=1:model.P) + sum(Θ[w]*ϵ[t - (model.seasonality*w)] for w=1:model.Q if (t - (model.seasonality*w) > 0)))
else
@expression(mod, ŷ[t=lb:T], c + trend*t + sum(β[i]*exogValues[t,i] for i=1:nExog) + sum(ϕ[i]*yValues[t - i] for i=1:model.p) + sum(θ[j]*ϵ[t - j] for j=1:model.q if (t-j > 0)))
@expression(mod, ŷ[t=lb:T], c + trend + sum(β[i]*exogValues[t,i] for i=1:nExog) + sum(ϕ[i]*yValues[t - i] for i=1:model.p) + sum(θ[j]*ϵ[t - j] for j=1:model.q if (t-j > 0)))
end

includeModelConstraints!(mod, yValues, T, lb, objectiveFunction)
Expand Down Expand Up @@ -1002,7 +1002,7 @@ function auto(
end

allowMean = isnothing(allowMean) ? (d+D == 0) : allowMean
allowDrift = isnothing(allowDrift) ? (d+D >= 1) : allowDrift
allowDrift = isnothing(allowDrift) ? (d+D == 1) : allowDrift

# Include initial models
candidateModels = Vector{SARIMAModel}()
Expand Down

0 comments on commit 557146e

Please sign in to comment.