From 37b28ce70bb2d2047fe03ec3efe7e83bfa88483a Mon Sep 17 00:00:00 2001 From: andre_ramos Date: Fri, 7 Feb 2025 12:37:10 -0300 Subject: [PATCH 1/2] fix model without stochastic components --- docs/src/examples.md | 2 +- src/estimation_procedure.jl | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/src/examples.md b/docs/src/examples.md index ba1d16d..d0f2d3f 100644 --- a/docs/src/examples.md +++ b/docs/src/examples.md @@ -86,7 +86,7 @@ y = solars[!, "values"] T = length(y) steps_ahead = 168 -model = StructuralModel(y; freq_seasonal=24) +model = StructuralModel(y; freq_seasonal=168) fit!(model) prediction = StateSpaceLearning.forecast(model, steps_ahead) # arguments are the output of the fitted model and number of steps ahead the user wants to forecast diff --git a/src/estimation_procedure.jl b/src/estimation_procedure.jl index 8f2cc12..d3548da 100644 --- a/src/estimation_procedure.jl +++ b/src/estimation_procedure.jl @@ -294,7 +294,9 @@ function estimation_procedure( if hasintercept penalty_factor = ones(size(Estimation_X, 2) - 1) - penalty_factor[components_indexes["initial_states"][2:end] .- 1] .= 0 + if length(penalty_factor) != length(components_indexes["initial_states"][2:end]) + penalty_factor[components_indexes["initial_states"][2:end] .- 1] .= 0 + end coefs, _ = fit_lasso( Estimation_X, estimation_y, @@ -307,7 +309,9 @@ function estimation_procedure( ) else penalty_factor = ones(size(Estimation_X, 2)) - penalty_factor[components_indexes["initial_states"][1:end]] .= 0 + if length(penalty_factor) != length(components_indexes["initial_states"]) + penalty_factor[components_indexes["initial_states"][1:end]] .= 0 + end coefs, _ = fit_lasso( Estimation_X, estimation_y, From caa6cac94599235dcf94c66a0a81072a43bab450 Mon Sep 17 00:00:00 2001 From: andre_ramos Date: Fri, 7 Feb 2025 12:37:29 -0300 Subject: [PATCH 2/2] add new version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index e987fdf..f0a6902 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StateSpaceLearning" uuid = "971c4b7c-2c4e-4bac-8525-e842df3cde7b" authors = ["andreramosfc "] -version = "1.3.1" +version = "1.3.2" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"