Skip to content

Commit

Permalink
Merge pull request #331 from LAMPSPUC/unobserved_components_with_exp
Browse files Browse the repository at this point in the history
add explanatory variables to unobserved_components
  • Loading branch information
guilhermebodin authored Oct 9, 2024
2 parents b0fe56c + 5c4ea4b commit b15f942
Show file tree
Hide file tree
Showing 4 changed files with 338 additions and 68 deletions.
1 change: 1 addition & 0 deletions src/StateSpaceModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ include("models/basicstructural_multivariate.jl")
include("models/sarima.jl")
include("models/linear_regression.jl")
include("models/unobserved_components.jl")

include("models/exponential_smoothing.jl")
include("models/naive_models.jl")
include("models/dar.jl")
Expand Down
8 changes: 4 additions & 4 deletions src/forecast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ function forecast(
for i in 1:steps_ahead
if isunivariate(model)
expected_value[i] = [
dot(model.system.Z[end - steps_ahead + i - 1], fo.a[end - steps_ahead + i - 1]) +
model.system.d[end - steps_ahead + i - 1],
dot(forecasting_model.system.Z[end - steps_ahead + i], fo.a[end - steps_ahead + i - 1]) +
forecasting_model.system.d[end - steps_ahead + i],
]
else
expected_value[i] =
model.system.Z[end - steps_ahead + i - 1] * fo.a[end - steps_ahead + i - 1] +
model.system.d[end - steps_ahead + i - 1]
forecasting_model.system.Z[end - steps_ahead + i] * fo.a[end - steps_ahead + i - 1] +
forecasting_model.system.d[end - steps_ahead + i]
end
covariance[i] = fo.F[end - steps_ahead + i]
end
Expand Down
Loading

0 comments on commit b15f942

Please sign in to comment.