Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Frédéric Karamé
dynare
Commits
49ae89ce
Commit
49ae89ce
authored
3 weeks ago
by
Frédéric Karamé
Browse files
Options
Downloads
Patches
Plain Diff
Bug fix: pruning at order 3.
parent
4a92614e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#11492
passed
3 weeks ago
Stage: build
Stage: test
Stage: pkg
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/nonlinear-filters/nonlinear_kalman_filter.m
+4
-3
4 additions, 3 deletions
matlab/nonlinear-filters/nonlinear_kalman_filter.m
with
4 additions
and
3 deletions
matlab/nonlinear-filters/nonlinear_kalman_filter.m
+
4
−
3
View file @
49ae89ce
...
...
@@ -92,6 +92,8 @@ number_of_state_variables = length(mf0);
number_of_observed_variables
=
length
(
mf1
);
number_of_structural_innovations
=
length
(
ReducedForm
.
Q
);
pruning
=
ParticleOptions
.
pruning
;
% compute gaussian quadrature nodes and weights on states and shocks
if
ParticleOptions
.
proposal_approximation
.
montecarlo
nodes
=
randn
(
ParticleOptions
.
number_of_particles
,
number_of_state_variables
+
number_of_structural_innovations
);
...
...
@@ -145,7 +147,7 @@ for t=1:sample_size
case
2
tmp
=
local_state_space_iteration_2
(
yhat
,
epsilon
,
ghx
,
ghu
,
constant
,
ghxx
,
ghuu
,
ghxu
,
ThreadsOptions
.
local_state_space_iteration_2
);
case
3
tmp
=
local_state_space_iteration_3
(
yhat
,
epsilon
,
ghx
,
ghu
,
ghxx
,
ghuu
,
ghxu
,
ghs2
,
ghxxx
,
ghuuu
,
ghxxu
,
ghxuu
,
ghxss
,
ghuss
,
steadystate
,
ThreadsOptions
.
local_state_space_iteration_3
,
pruning
);
tmp
=
local_state_space_iteration_3
(
yhat
,
epsilon
,
ghx
,
ghu
,
ghxx
,
ghuu
,
ghxu
,
ghs2
,
ghxxx
,
ghuuu
,
ghxxu
,
ghxuu
,
ghxss
,
ghuss
,
steadystate
,
ThreadsOptions
.
local_state_space_iteration_3
,
pruning
);
otherwise
error
(
'Order > 3: use_k_order_solver should be set to true'
);
end
...
...
@@ -181,13 +183,12 @@ for t=1:sample_size
lik
(
t
)
=-
Inf
;
return
end
[
~
,
p
]
=
chol
(
PredictedObservedVariance
,
'lower'
);
[
PredictedObservedVarianceSquareRoot
,
p
]
=
chol
(
PredictedObservedVariance
,
'lower'
);
if
p
LIK
=-
Inf
;
lik
(
t
)
=-
Inf
;
return
end
PredictedObservedVarianceSquareRoot
=
chol
(
PredictedObservedVariance
);
end
PredictedObservedInverseVarianceSquareRoot
=
PredictedObservedVarianceSquareRoot
\
eye
(
n
);
% Inverse of the Cholesky -> inv(PredictedObservedVariance) = A*A'
StandardPredictionError
=
PredictedObservedInverseVarianceSquareRoot
'*
PredictionError
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment