Skip to content

Commit bca817f

Browse files
Merge pull request #319 from LAMPSPUC/gb/fix_smooth_trend
fix smooth trend
2 parents fb60be8 + ca97fd5 commit bca817f

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StateSpaceModels"
22
uuid = "99342f36-827c-5390-97c9-d7f9ee765c78"
33
authors = ["raphaelsaavedra <[email protected]>, guilhermebodin <[email protected]>, mariohsouto"]
4-
version = "0.6.6"
4+
version = "0.6.7"
55

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

src/models/unobserved_components.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ function initial_hyperparameters!(model::UnobservedComponents)
461461
if model.has_irregular
462462
initial_hyperparameters["sigma2_irregular"] = observed_variance
463463
end
464-
if model.has_trend
464+
if model.stochastic_trend
465465
initial_hyperparameters["sigma2_trend"] = observed_variance
466466
end
467467
if model.has_cycle

test/models/sarima.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# Values are very close to 0.0 so we test with absolute tolerance
3030
# It attains 1e-3 when we make 10M simulations, which is too much
3131
# computation for a rather simple test.
32-
test_scenarios_adequacy_with_forecast(forec, scenarios; atol=1e-1)
32+
test_scenarios_adequacy_with_forecast(forec, scenarios; atol=2e-1)
3333

3434
missing_obs = [6, 16, 26, 36, 46, 56, 66, 72, 73, 74, 75, 76, 86, 96]
3535
missing_dinternet = copy(dinternet)

test/models/unobserved_components.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,9 @@
4040
@test minimum(alpha[:, 1]) <= 296
4141
@test maximum(alpha[:, 2]) >= 7.5
4242
@test minimum(alpha[:, 2]) <= -7.5
43+
44+
# Testing that it does not break
45+
rj_temp = CSV.File(StateSpaceModels.RJ_TEMPERATURE) |> DataFrame
46+
model = UnobservedComponents(rj_temp.Values; trend = "smooth trend", cycle = "stochastic")
47+
fit!(model)
4348
end

0 commit comments

Comments
 (0)