Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot predict for more steps than number of observations #324

Open
SupplyChef opened this issue Nov 3, 2023 · 0 comments
Open

Cannot predict for more steps than number of observations #324

SupplyChef opened this issue Nov 3, 2023 · 0 comments

Comments

@SupplyChef
Copy link

When trying to sample future scenarios from a BasicStructuralExplanatory model, I get the error shown below. I believe this is because the sampling code reuses the arrays (ie, Z) that were sized with the number of observations used to fit the model. This fails when the number of steps to sample for is greater than the number of observations.

BoundsError: attempt to access 9-element Vector{Vector{Float64}} at index [10]
│ Stacktrace:
│ [1] getindex(A::Vector{Vector{Float64}}, i1::Int64)
│ @ Base .\essentials.jl:13
│ [2] simulate(model::StateSpaceModels.BasicStructuralExplanatory, initial_state::Vector{Float64}, n::Int64, new_exogenous::Matrix{Float64}; return_simulated_states::Bool)
│ @ StateSpaceModels C:\Users\renau.julia\packages\StateSpaceModels\DmxMT\src\models\basicstructural_explanatory.jl:209
│ [3] simulate
│ @ C:\Users\renau.julia\packages\StateSpaceModels\DmxMT\src\models\basicstructural_explanatory.jl:182 [inlined]
│ [4] simulate_scenarios(model::StateSpaceModels.BasicStructuralExplanatory, steps_ahead::Int64, n_scenarios::Int64, new_exogenous::Array{Float64, 3}; filter::StateSpaceModels.UnivariateKalmanFilter{Float64})
│ @ StateSpaceModels C:\Users\renau.julia\packages\StateSpaceModels\DmxMT\src\models\basicstructural_explanatory.jl:177
│ [5] simulate_scenarios(model::StateSpaceModels.BasicStructuralExplanatory, steps_ahead::Int64, n_scenarios::Int64, new_exogenous::Array{Float64, 3})
│ @ StateSpaceModels C:\Users\renau.julia\packages\StateSpaceModels\DmxMT\src\models\basicstructural_explanatory.jl:161
│ [6] sample_structural_explanatory(dates::Vector{Dates.Date}, values::Vector{Float64}, seasonality::Int64, event_dates::Vector{Dates.Date}, events::Vector{String}, horizon::Int64; scenario_count::Int64)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant