Skip to content

Commit 37b28ce

Browse files
author
andre_ramos
committed
fix model without stochastic components
1 parent 8855f2e commit 37b28ce

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

docs/src/examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ y = solars[!, "values"]
8686
T = length(y)
8787
steps_ahead = 168
8888

89-
model = StructuralModel(y; freq_seasonal=24)
89+
model = StructuralModel(y; freq_seasonal=168)
9090
fit!(model)
9191
prediction = StateSpaceLearning.forecast(model, steps_ahead) # arguments are the output of the fitted model and number of steps ahead the user wants to forecast
9292

src/estimation_procedure.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ function estimation_procedure(
294294

295295
if hasintercept
296296
penalty_factor = ones(size(Estimation_X, 2) - 1)
297-
penalty_factor[components_indexes["initial_states"][2:end] .- 1] .= 0
297+
if length(penalty_factor) != length(components_indexes["initial_states"][2:end])
298+
penalty_factor[components_indexes["initial_states"][2:end] .- 1] .= 0
299+
end
298300
coefs, _ = fit_lasso(
299301
Estimation_X,
300302
estimation_y,
@@ -307,7 +309,9 @@ function estimation_procedure(
307309
)
308310
else
309311
penalty_factor = ones(size(Estimation_X, 2))
310-
penalty_factor[components_indexes["initial_states"][1:end]] .= 0
312+
if length(penalty_factor) != length(components_indexes["initial_states"])
313+
penalty_factor[components_indexes["initial_states"][1:end]] .= 0
314+
end
311315
coefs, _ = fit_lasso(
312316
Estimation_X,
313317
estimation_y,

0 commit comments

Comments
 (0)