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
Johannes Pfeifer
dynare
Commits
74d7c8a7
Commit
74d7c8a7
authored
Nov 12, 2020
by
Sébastien Villemot
Browse files
Merge branch 'pf_init' into 'master'
Fix initialization of state variances See merge request
Dynare/dynare!1762
parents
5fd2a064
dab5d380
Changes
1
Hide whitespace changes
Inline
Side-by-side
matlab/non_linear_dsge_likelihood.m
View file @
74d7c8a7
...
...
@@ -135,14 +135,16 @@ end
switch
DynareOptions
.
particle
.
initialization
case
1
% Initial state vector covariance is the ergodic variance associated to the first order Taylor-approximation of the model.
StateVectorMean
=
ReducedForm
.
constant
(
mf0
);
StateVectorVariance
=
lyapunov_symm
(
dr
.
ghx
(
mf0
,:),
dr
.
ghu
(
mf0
,:)
*
Q
*
dr
.
ghu
(
mf0
,:)
'
,
DynareOptions
.
lyapunov_fixed_point_tol
,
...
[
A
,
B
]
=
kalman_transition_matrix
(
dr
,
dr
.
restrict_var_list
,
dr
.
restrict_columns
,
Model
.
exo_nbr
);
StateVectorVariance
=
lyapunov_symm
(
A
,
B
*
Q
*
B
'
,
DynareOptions
.
lyapunov_fixed_point_tol
,
...
DynareOptions
.
qz_criterium
,
DynareOptions
.
lyapunov_complex_threshold
,
[],
DynareOptions
.
debug
);
StateVectorVariance
=
StateVectorVariance
(
mf0
,
mf0
);
case
2
% Initial state vector covariance is a monte-carlo based estimate of the ergodic variance (consistent with a k-order Taylor-approximation of the model).
StateVectorMean
=
ReducedForm
.
constant
(
mf0
);
old_DynareOptionsperiods
=
DynareOptions
.
periods
;
DynareOptions
.
periods
=
5000
;
y_
=
simult
(
DynareResults
.
steady_state
,
dr
,
Model
,
DynareOptions
,
DynareResults
);
y_
=
y_
(
state_variables_idx
,
2001
:
5000
);
y_
=
y_
(
dr
.
order_var
(
state_variables_idx
)
,
2001
:
5000
);
%state_variables_idx is in dr-order while simult_ is in declaration order
StateVectorVariance
=
cov
(
y_
'
);
DynareOptions
.
periods
=
old_DynareOptionsperiods
;
clear
(
'old_DynareOptionsperiods'
,
'y_'
);
...
...
Write
Preview
Supports
Markdown
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