diff --git a/Project.toml b/Project.toml index 49c19f0..96fdfbd 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StateSpaceModels" uuid = "99342f36-827c-5390-97c9-d7f9ee765c78" authors = ["raphaelsaavedra , guilhermebodin , mariohsouto"] -version = "0.6.6" +version = "0.6.7" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" diff --git a/src/models/unobserved_components.jl b/src/models/unobserved_components.jl index 262a522..36420e5 100644 --- a/src/models/unobserved_components.jl +++ b/src/models/unobserved_components.jl @@ -461,7 +461,7 @@ function initial_hyperparameters!(model::UnobservedComponents) if model.has_irregular initial_hyperparameters["sigma2_irregular"] = observed_variance end - if model.has_trend + if model.stochastic_trend initial_hyperparameters["sigma2_trend"] = observed_variance end if model.has_cycle diff --git a/test/models/sarima.jl b/test/models/sarima.jl index ee9c786..f1bbca7 100644 --- a/test/models/sarima.jl +++ b/test/models/sarima.jl @@ -29,7 +29,7 @@ # Values are very close to 0.0 so we test with absolute tolerance # It attains 1e-3 when we make 10M simulations, which is too much # computation for a rather simple test. - test_scenarios_adequacy_with_forecast(forec, scenarios; atol=1e-1) + test_scenarios_adequacy_with_forecast(forec, scenarios; atol=2e-1) missing_obs = [6, 16, 26, 36, 46, 56, 66, 72, 73, 74, 75, 76, 86, 96] missing_dinternet = copy(dinternet) diff --git a/test/models/unobserved_components.jl b/test/models/unobserved_components.jl index f2c2192..0ce640e 100644 --- a/test/models/unobserved_components.jl +++ b/test/models/unobserved_components.jl @@ -40,4 +40,9 @@ @test minimum(alpha[:, 1]) <= 296 @test maximum(alpha[:, 2]) >= 7.5 @test minimum(alpha[:, 2]) <= -7.5 + + # Testing that it does not break + rj_temp = CSV.File(StateSpaceModels.RJ_TEMPERATURE) |> DataFrame + model = UnobservedComponents(rj_temp.Values; trend = "smooth trend", cycle = "stochastic") + fit!(model) end \ No newline at end of file