Giter Site home page Giter Site logo

Comments (3)

guilhermebodin avatar guilhermebodin commented on August 25, 2024

We can rewrite those asserts

    @assert max_p > 0
    @assert max_q > 0
    @assert max_d > 0
    @assert max_P > 0
    @assert max_D > 0
    @assert max_Q > 0
    @assert max_order > 0

There is no reason for them to be strictly positive

from statespacemodels.jl.

dazhwu avatar dazhwu commented on August 25, 2024

I changed the following line in the auto_arima function:

@Assert max_q >= 0

Changing ">" to ">=" allows me to call auto_arima with max_q=0 (my intention is to pick up the best AR model):

mdl_ar=StateSpaceModels.auto_arima(mdl_ivx["ols_residuals"], max_p=5, d=0, max_q=0, information_criteria="bic")
StateSpaceModels.fit!(mdl_ar)
print(mdl_ar.results)

However, the model chosen by auto_arima is p=2; d=0; q=2:

StateSpaceModels.Results{Float64}("SARIMA(2, 0, 2)x(0, 0, 0, 0) with zero mean    ", StateSpaceModels.CoefficientTable{Float64}(["ar_L1", "ar_L2", "ma_L1", "ma_L2", "sigma2_η"], [0.5812890069326717, 0.3225272626177295, -0.0740566496419704, -0.3756228739571143, 7.081303066016176e-5], [NaN, 
NaN, NaN, NaN, NaN], [NaN, NaN, NaN, NaN, NaN], [NaN, NaN, NaN, NaN, NaN]), 580.6591619420767, -1151.3183238841534, -1150.9590424470277, -1135.5518659116644, 173, 5) *  Terminal will be reused by tasks, press any key to close it. 

Obviously, (2, 0, 2) doesn't satisfy the requirement of max_q=0.
(2, 0, 2) was generated by the following block.

if seasonal == 0
        push!(candidate_models, SARIMA(y; order = (2, d, 2), include_mean = include_mean, suppress_warns = true))
        push!(candidate_models, SARIMA(y; order = (0, d, 0), include_mean = include_mean, suppress_warns = true))
        push!(candidate_models, SARIMA(y; order = (1, d, 0), include_mean = include_mean, suppress_warns = true))
        push!(candidate_models, SARIMA(y; order = (0, d, 1), include_mean = include_mean, suppress_warns = true))

I guess the two instances of “-1:1" in code below need to be changed.

function add_new_p_q_models!(candidate_models::Vector{SARIMA}, 
                             max_p::Int, max_q::Int, max_order::Int,
                             visited_models::Vector{NamedTuple})
    best_model = candidate_models[1]
    for p in -1:1, q in -1:1
        new_p = best_model.order.p + p
        new_q = best_model.order.q + q
        # invalid new orders

from statespacemodels.jl.

guilhermebodin avatar guilhermebodin commented on August 25, 2024

Hi @dazhwu thanks for the tests, I will merge this PR tomorrow and release a new version with the fixes. If you want to test it right now you can add the specific branch of the fix add StateSpaceModels#gb/fix-auto-arima-orders.

from statespacemodels.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.