Skip to content
This repository has been archived by the owner. It is now read-only.

Fix various Kalman filter bugs #1235

Closed

Conversation

Projects
None yet
4 participants
@JohannesPfeifer
Copy link
Contributor

commented Jun 16, 2016

  • Fix bug in dsge_likelihood.m where diagonal of measurement error covariance matrix was not correctly read out, leading to wrong results when using the univariate Kalman filter with measurement error
  • Various bugfixes for univariate smoother when (correlated) measurement error is present
  • Bugfix for missing_observations_kalman_filter_d.m where constant of log(2*pi) was forgotten in last step
  • Documents Kalman routines
  • Factorizes and improves unit tests
  • Filters out infinite likelihoods with proper error code
  • Fixes variable count bug in display_problematic_vars_Jacobian.m that led to crashes in debug-mode

Closes #1231

Closes #1234

JohannesPfeifer added some commits Jun 14, 2016

display_problematic_vars_Jacobian.m: Fix bug where exogenous variable…
…s in dynamic Jacobian were not accounted for Prevents crashes in debug mode
Fix bug in dsge_likelihood.m where diagonal of measurement error cova…
…riance matrix was not correctly read out

This is a prerequisite for the univariate filter that operates along a vector for H instead of along the diagonal. Because of this, the likelihood in the presence of measurement error was wrong
@JohannesPfeifer

This comment has been minimized.

Copy link
Contributor Author

commented Jun 16, 2016

@stepan-a Could you please try tests/kalman_filter_smoother/algo2? It works on my machine but crashes on Sedna and I don't understand why.

@MichelJuillard

This comment has been minimized.

Copy link
Member

commented Jun 18, 2016

@JohannesPfeifer the 2*pi constant is a difficult issue in diffuse Kalman filter. If I remember correctly, because the diffuse prior is not a proper prior on initial values, the marginal density can't be compared between models and it is illusory to search for the "correct" constant. Sorry, this is a little fuzzy in my memory. Or maybe @JohannesPfeifer, do you only put the code in conformity with Durbin's formula?

@JohannesPfeifer

This comment has been minimized.

Copy link
Contributor Author

commented Jun 18, 2016

@MichelJuillard The formula is simply incorrectly implemented in the second branch of the if-clause. Formula 7.4 of DK (2012) clearly states that in any case the 2*pi must be added, but we do so in only one branch. This explains why even for the same model where no diffuse step are necessary the results differ

@MichelJuillard

This comment has been minimized.

Copy link
Member

commented Jun 18, 2016

OK then

@rattoma

This comment has been minimized.

Copy link
Member

commented Jun 18, 2016

@JohannesPfeifer thanks a lot for spotting this

Add comment on logic of singularity testing in univariate_kalman_filt…
…er_d.m

See discussion on mailing list 18/06/2016
@JohannesPfeifer

This comment has been minimized.

Copy link
Contributor Author

commented Jun 19, 2016

@stepan-a Never mind. My mistake, the testsuite works.

@stepan-a

This comment has been minimized.

Copy link
Member

commented Aug 22, 2016

Manually merged.

@stepan-a stepan-a closed this Aug 22, 2016

@JohannesPfeifer JohannesPfeifer deleted the JohannesPfeifer:univariate_filter branch Aug 23, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.