Skip to content

Commit 2b828bf

Browse files
Merge pull request #65 from LAMPSPUC/handle_decomposition_edge_cases
handle decomposition edge cases
2 parents f35505d + 2be51bd commit 2b828bf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StateSpaceLearning"
22
uuid = "971c4b7c-2c4e-4bac-8525-e842df3cde7b"
33
authors = ["andreramosfc <andreramosfdc@gmail.com>"]
4-
version = "2.0.2"
4+
version = "2.0.3"
55

66
[deps]
77
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"

src/models/structural_model.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ function get_trend_decomposition(
10801080
trend[1] = 0.0
10811081
end
10821082

1083-
if model.stochastic_level
1083+
if model.stochastic_level && !isempty(components["ξ"]["Coefs"])
10841084
ξ = vcat(zeros(max(2, model.stochastic_start) - 1), components["ξ"]["Coefs"], 0.0)
10851085
@assert length(ξ) == T
10861086
else
@@ -1119,7 +1119,7 @@ function get_slope_decomposition(
11191119
slope[1] = 0.0
11201120
end
11211121

1122-
if model.stochastic_slope
1122+
if model.stochastic_slope && !isempty(components["ζ"]["Coefs"])
11231123
ζ = vcat(
11241124
zeros(max(2, model.stochastic_start)),
11251125
components["ζ"]["Coefs"],
@@ -1163,7 +1163,7 @@ function get_seasonal_decomposition(
11631163
seasonal[1:s] = zeros(AbstractFloat, s)
11641164
end
11651165

1166-
if model.stochastic_seasonal
1166+
if model.stochastic_seasonal && !isempty(components["ω_$(s)"]["Coefs"])
11671167
ω = vcat(
11681168
zeros(s - 1 + max(0, max(2, model.stochastic_start) - s)),
11691169
components["ω_$(s)"]["Coefs"],

0 commit comments

Comments
 (0)