Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
dynare
dynare
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 122
    • Issues 122
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Dynare
  • dynaredynare
  • Issues
  • #1768

Closed
Open
Opened Jan 17, 2021 by Johannes Pfeifer @JohannesPfeiferDeveloper

Harmonize output of local_state_space_iteration_k and local_state_space_iteration_2

local_state_space_iteration_k has all endogenous variables as its output, while local_state_space_iteration_2 has only restrict_var_list (i.e. drops static variables that are not observed). Nevertheless in pretty much all particle filters we have code like

if ReducedForm.use_k_order_solver
  tmp = local_state_space_iteration_k(yhat, epsilon, dr, Model, DynareOptions);
else
  tmp = local_state_space_iteration_2(yhat,epsilon,ghx,ghu,constant,ghxx,ghuu,ghxu,ThreadsOptions.local_state_space_iteration_2);
end
PredictionError = bsxfun(@minus,Y(:,t),tmp(mf1,:));

where mf1 is the position of the observables in restrict_var_list. Consequently, the use of k_order_solver will generally return wrong result as we are reading out the wrong variables. There are two ways of fixing this:

  1. Change indexing for reading out to restrict_var_list(mf1) in various subfunctions
  2. Make the output of local_state_space_iteration_k and local_state_space_iteration_2 consistent to output only restrict_var_list

I would prefer option 2 as it makes the code faster and we do not need to introduce additional case distinctions that make the code hard to parse.

Relatedly, local_state_space_iteration_2 is about 60 times faster than local_state_space_iteration_k at the same order=2, see https://git.dynare.org/Dynare/dynare/-/blob/master/tests/particle/local_state_space_iteration_k_test.mod so any changes should keep this in mind.

Edited Jan 18, 2021 by Johannes Pfeifer
Assignee
Assign to
4.7
Milestone
4.7
Assign milestone
Time tracking
None
Due date
None
Reference: Dynare/dynare#1768