From cba2be34dd3fb2115afcd4929922302c831d63df Mon Sep 17 00:00:00 2001 From: andre_ramos Date: Wed, 13 Aug 2025 18:57:17 -0300 Subject: [PATCH] fix simulation for model with level and without slope --- Project.toml | 2 +- src/models/structural_model.jl | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Project.toml b/Project.toml index de1962a..9a739b9 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StateSpaceLearning" uuid = "971c4b7c-2c4e-4bac-8525-e842df3cde7b" authors = ["andreramosfc "] -version = "2.0.9" +version = "2.0.10" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" diff --git a/src/models/structural_model.jl b/src/models/structural_model.jl index 5a2241a..a27ac6b 100644 --- a/src/models/structural_model.jl +++ b/src/models/structural_model.jl @@ -95,10 +95,10 @@ mutable struct StructuralModel <: StateSpaceLearningModel @assert !has_intercept(exog) "Exogenous matrix must not have an intercept column" @assert 1 <= stochastic_start < length(y) "stochastic_start must be greater than or equal to 1 and smaller than the length of the time series" - @assert level in ["deterministic", "stochastic", "none"] "level must be either deterministic, stochastic or no" - @assert slope in ["deterministic", "stochastic", "none"] "slope must be either deterministic, stochastic or no" - @assert seasonal in ["deterministic", "stochastic", "none"] "seasonal must be either deterministic, stochastic or no" - @assert cycle in ["deterministic", "stochastic", "none"] "cycle must be either deterministic, stochastic or no" + @assert level in ["deterministic", "stochastic", "none"] "level must be either deterministic, stochastic or none" + @assert slope in ["deterministic", "stochastic", "none"] "slope must be either deterministic, stochastic or none" + @assert seasonal in ["deterministic", "stochastic", "none"] "seasonal must be either deterministic, stochastic or none" + @assert cycle in ["deterministic", "stochastic", "none"] "cycle must be either deterministic, stochastic or none" @assert seasonal != "none" ? length(y) > minimum(freq_seasonal) : true "Time series must be longer than the seasonal period if seasonal is added" if typeof(freq_seasonal) <: Vector @@ -1591,7 +1591,7 @@ function simulate_states( ) end - model.slope ? slope = ones(T, N_scenarios) .* slope : nothing + slope = ones(T, N_scenarios) .* slope model.level ? trend = ones(T, N_scenarios) .* trend : nothing model.seasonal ? seasonals = [ones(T, N_scenarios) .* s for s in seasonals] : nothing for t in (T + 1):(T + steps_ahead)