Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dynare
particles
Commits
80af764e
Commit
80af764e
authored
Dec 12, 2014
by
Stéphane Adjemian
Browse files
Replaced DynareOptions by ParticleOptions and ThreadsOptions.
parent
f4a1f065
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/auxiliary_initialization.m
View file @
80af764e
function
initial_distribution
=
auxiliary_initialization
(
ReducedForm
,
Y
,
start
,
Dynare
Options
)
function
initial_distribution
=
auxiliary_initialization
(
ReducedForm
,
Y
,
start
,
ParticleOptions
,
Threads
Options
)
% Evaluates the likelihood of a nonlinear model with a particle filter allowing eventually resampling.
%
% INPUTS
...
...
@@ -45,7 +45,7 @@ if isempty(start)
end
% Set flag for prunning
%pruning =
Dynar
eOptions.
particle.
pruning;
%pruning =
Particl
eOptions.pruning;
% Get steady state and mean.
%steadystate = ReducedForm.steadystate;
...
...
@@ -58,7 +58,7 @@ if isempty(init_flag)
mf1
=
ReducedForm
.
mf1
;
number_of_observed_variables
=
length
(
mf1
);
number_of_structural_innovations
=
length
(
ReducedForm
.
Q
);
number_of_particles
=
Dynar
eOptions
.
particle
.
number_of_particles
;
number_of_particles
=
Particl
eOptions
.
number_of_particles
;
init_flag
=
1
;
end
...
...
@@ -102,9 +102,9 @@ StateVectors = bsxfun(@plus,StateVectorVarianceSquareRoot*randn(state_variance_r
yhat
=
bsxfun
(
@
minus
,
StateVectors
,
state_variables_steady_state
);
%if pruning
% yhat_ = bsxfun(@minus,StateVectors_,state_variables_steady_state);
% [tmp, tmp_] = local_state_space_iteration_2(yhat,zeros(number_of_structural_innovations,number_of_particles),ghx,ghu,constant,ghxx,ghuu,ghxu,yhat_,steadystate,
DynareOptions.thread
s.local_state_space_iteration_2);
% [tmp, tmp_] = local_state_space_iteration_2(yhat,zeros(number_of_structural_innovations,number_of_particles),ghx,ghu,constant,ghxx,ghuu,ghxu,yhat_,steadystate,
ThreadsOption
s.local_state_space_iteration_2);
%else
tmp
=
local_state_space_iteration_2
(
yhat
,
zeros
(
number_of_structural_innovations
,
number_of_particles
),
ghx
,
ghu
,
constant
,
ghxx
,
ghuu
,
ghxu
,
DynareOptions
.
thread
s
.
local_state_space_iteration_2
);
tmp
=
local_state_space_iteration_2
(
yhat
,
zeros
(
number_of_structural_innovations
,
number_of_particles
),
ghx
,
ghu
,
constant
,
ghxx
,
ghuu
,
ghxu
,
ThreadsOption
s
.
local_state_space_iteration_2
);
%end
PredictedObservedMean
=
weights
*
(
tmp
(
mf1
,:)
'
);
PredictionError
=
bsxfun
(
@
minus
,
Y
(:,
t
),
tmp
(
mf1
,:));
...
...
@@ -113,4 +113,4 @@ PredictedObservedVariance = bsxfun(@times,weights,dPredictedObservedMean)*dPredi
wtilde
=
exp
(
-.
5
*
(
const_lik
+
log
(
det
(
PredictedObservedVariance
))
+
sum
(
PredictionError
.*
(
PredictedObservedVariance
\
PredictionError
),
1
)))
;
tau_tilde
=
weights
.*
wtilde
;
tau_tilde
=
tau_tilde
/
sum
(
tau_tilde
);
initial_distribution
=
resample
(
StateVectors
',tau_tilde'
,
DynareOptions
)
'
;
\ No newline at end of file
initial_distribution
=
resample
(
StateVectors
',tau_tilde'
,
ParticleOptions
)
'
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment