Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • dynare dynare
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 108
    • Issues 108
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Dynare
  • dynaredynare
  • Issues
  • #1768
Closed
Open
Created 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
Time tracking