Skip to content

Commit

Permalink
Merge pull request #13 from fipelle/dev
Browse files Browse the repository at this point in the history
Dev: Minor update to support the new sequential approach for filtering and smoothing in MessyTimeSeries.jl
  • Loading branch information
fipelle authored Jul 26, 2022
2 parents 080a9ca + 62b2247 commit f8a7889
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "MessyTimeSeriesOptim"
uuid = "7115d47b-e118-4204-bc33-dbd7ed133e66"
version = "0.1.5"
version = "0.1.6"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
4 changes: 2 additions & 2 deletions src/estimation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ Kalman smoother and CM-step for initial conditions (i.e., X0 and P0)
APIs to call `MessyTimeSeries.update_smoothing_factors!` with SmootherArrays.
"""
call_update_smoothing_factors!(sspace::KalmanSettings, status::SizedKalmanStatus, smoother_arrays::SmootherArrays, ind_not_missings::Union{IntVector, Nothing}, e::Union{FloatVector, Nothing}, inv_F::Union{SymMatrix, Nothing}, L::Union{FloatMatrix, Nothing}) = update_smoothing_factors!(sspace, status, ind_not_missings, smoother_arrays.J1, smoother_arrays.J2, e, inv_F, L);
call_update_smoothing_factors!(sspace::KalmanSettings, status::SizedKalmanStatus, smoother_arrays::SmootherArrays, ind_not_missings::Union{IntVector, Nothing}, e::Union{FloatVector, Nothing}, inv_F::Union{SymMatrix, FloatVector, Nothing}, L::Union{FloatMatrix, Vector{FloatMatrix}, Nothing}) = update_smoothing_factors!(sspace, status, ind_not_missings, smoother_arrays.J1, smoother_arrays.J2, e, inv_F, L);
call_update_smoothing_factors!(sspace::KalmanSettings, status::SizedKalmanStatus, smoother_arrays::SmootherArrays, ind_not_missings::Union{IntVector, Nothing}) = update_smoothing_factors!(sspace, status, ind_not_missings, smoother_arrays.J1, smoother_arrays.J2);

"""
Expand Down Expand Up @@ -779,7 +779,7 @@ function ecm(estim::EstimSettings; output_sspace_data::Union{FloatMatrix, JMatri
sspace, B_star, C_star, Q_view, coordinates_measurement_states, coordinates_transition_current, coordinates_transition_lagged, coordinates_transition_PPs, coordinates_transition_P0, coordinates_free_params_B, coordinates_free_params_C = initialise(estim);

# Pre-allocate memory for Kalman filter and smoother
status = SizedKalmanStatus(sspace.Y.T);
status = SizedKalmanStatus(sspace);
smoother_arrays = SmootherArrays(estim, sspace, coordinates_measurement_states, coordinates_transition_current, coordinates_transition_lagged, coordinates_transition_PPs);

# ECM controls
Expand Down
2 changes: 1 addition & 1 deletion test/dfm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function naive_dfm_simulation(true_loadings::FloatMatrix, true_dynamics::FloatMa
sspace = ecm(estim);

# Run Kalman filter
status = SizedKalmanStatus(sspace.Y.T);
status = SizedKalmanStatus(sspace);
kfilter_full_sample!(sspace, status);

X_sm, P_sm, X0_sm, P0_sm = ksmoother(sspace, status);
Expand Down
2 changes: 1 addition & 1 deletion test/dfm_write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function naive_dfm_simulation(true_loadings::FloatMatrix, true_dynamics::FloatMa
sspace = ecm(estim);

# Run Kalman filter
status = SizedKalmanStatus(sspace.Y.T);
status = SizedKalmanStatus(sspace);
kfilter_full_sample!(sspace, status);

X_sm, P_sm, X0_sm, P0_sm = ksmoother(sspace, status);
Expand Down
2 changes: 1 addition & 1 deletion test/var.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function var_estimation_test(Y::JArray, q::Int64, λ::Number, α::Number, β::Nu
=#

# Run Kalman filter
status = SizedKalmanStatus(sspace.Y.T);
status = SizedKalmanStatus(sspace);
kfilter_full_sample!(sspace, status);

# Compute Kalman stats from the ksmoother function
Expand Down
2 changes: 1 addition & 1 deletion test/vma.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function vma_estimation_test(Y::JArray, r::Int64, λ::Number, α::Number, β::Nu
=#

# Run Kalman filter
status = SizedKalmanStatus(sspace.Y.T);
status = SizedKalmanStatus(sspace);
kfilter_full_sample!(sspace, status);

# Compute Kalman stats from the ksmoother function
Expand Down

0 comments on commit f8a7889

Please sign in to comment.