Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
particles
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
Archives
particles
Commits
13d79cb4
Commit
13d79cb4
authored
5 years ago
by
Stéphane Adjemian
Browse files
Options
Downloads
Patches
Plain Diff
Allow k order approximation in SIP filter.
parent
a0fb5c73
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sequential_importance_particle_filter.m
+18
-10
18 additions, 10 deletions
src/sequential_importance_particle_filter.m
with
18 additions
and
10 deletions
src/sequential_importance_particle_filter.m
+
18
−
10
View file @
13d79cb4
function
[
LIK
,
lik
]
=
sequential_importance_particle_filter
(
ReducedForm
,
Y
,
start
,
ParticleOptions
,
ThreadsOptions
)
function
[
LIK
,
lik
]
=
sequential_importance_particle_filter
(
ReducedForm
,
Y
,
start
,
ParticleOptions
,
ThreadsOptions
,
DynareOptions
,
Model
)
% Evaluates the likelihood of a nonlinear model with a particle filter (optionally with resampling).
...
...
@@ -49,14 +49,18 @@ if isempty(init_flag)
init_flag
=
1
;
end
% Set local state space model (first order approximation).
ghx
=
ReducedForm
.
ghx
;
ghu
=
ReducedForm
.
ghu
;
% Set local state space model (second order approximation).
ghxx
=
ReducedForm
.
ghxx
;
ghuu
=
ReducedForm
.
ghuu
;
ghxu
=
ReducedForm
.
ghxu
;
if
ReducedForm
.
use_k_order_solver
dr
=
ReducedForm
.
dr
;
else
% Set local state space model (first order approximation).
ghx
=
ReducedForm
.
ghx
;
ghu
=
ReducedForm
.
ghu
;
% Set local state space model (second order approximation).
ghxx
=
ReducedForm
.
ghxx
;
ghuu
=
ReducedForm
.
ghuu
;
ghxu
=
ReducedForm
.
ghxu
;
end
% Get covariance matrices.
Q
=
ReducedForm
.
Q
;
% Covariance matrix of the structural innovations.
...
...
@@ -101,7 +105,11 @@ for t=1:sample_size
yhat_
=
bsxfun
(
@
minus
,
StateVectors_
,
state_variables_steady_state
);
[
tmp
,
tmp_
]
=
local_state_space_iteration_2
(
yhat
,
epsilon
,
ghx
,
ghu
,
constant
,
ghxx
,
ghuu
,
ghxu
,
yhat_
,
steadystate
,
ThreadsOptions
.
local_state_space_iteration_2
);
else
tmp
=
local_state_space_iteration_2
(
yhat
,
epsilon
,
ghx
,
ghu
,
constant
,
ghxx
,
ghuu
,
ghxu
,
ThreadsOptions
.
local_state_space_iteration_2
);
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
end
%PredictedObservedMean = tmp(mf1,:)*transpose(weights);
PredictionError
=
bsxfun
(
@
minus
,
Y
(:,
t
),
tmp
(
mf1
,:));
...
...
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