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
Dynare
dynare
Commits
9a32720a
Commit
9a32720a
authored
3 years ago
by
Johannes Pfeifer
Browse files
Options
Downloads
Patches
Plain Diff
evaluate_steady_state.m: allow debugging of Ramsey equations
parent
3f40404b
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1959
Various fixes around Ramsey
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/evaluate_steady_state.m
+29
-1
29 additions, 1 deletion
matlab/evaluate_steady_state.m
with
29 additions
and
1 deletion
matlab/evaluate_steady_state.m
+
29
−
1
View file @
9a32720a
...
...
@@ -57,7 +57,11 @@ if options.ramsey_policy
[
ys
,
params
,
info
]
=
evaluate_steady_state_file
(
ys_init
,
exo_ss
,
M
,
...
options
,
steadystate_check_flag
);
%test whether it solves model conditional on the instruments
resids
=
evaluate_static_model
(
ys
,
exo_ss
,
params
,
M
,
options
);
if
~
options
.
debug
resids
=
evaluate_static_model
(
ys
,
exo_ss
,
params
,
M
,
options
);
else
[
resids
,
~
,
jacob
]
=
evaluate_static_model
(
ys
,
exo_ss
,
params
,
M
,
options
);
end
n_multipliers
=
M
.
ramsey_eq_nbr
;
nan_indices
=
find
(
isnan
(
resids
(
n_multipliers
+
1
:
end
)));
...
...
@@ -132,6 +136,30 @@ if options.ramsey_policy
fprintf
(
'%s\n'
,
M
.
endo_names
{
nanrow
(
iter
)});
end
end
nan_indices_mult
=
find
(
isnan
(
resids
(
1
:
n_multipliers
)));
if
any
(
nan_indices_mult
)
fprintf
(
'evaluate_steady_state: The steady state results NaN for auxiliary equation %u.\n'
,
nan_indices_mult
);
fprintf
(
'evaluate_steady_state: This is often a sign of problems.\n'
);
end
[
infrow
,
infcol
]
=
find
(
isinf
(
jacob
));
if
~
isempty
(
infrow
)
fprintf
(
'\nevaluate_steady_state: The Jacobian of the dynamic model contains Inf. The problem is associated with:\n\n'
)
display_problematic_vars_Jacobian
(
infrow
,
infcol
,
M
,
ys
,
'static'
,
'evaluate_steady_state: '
)
end
if
~
isreal
(
jacob
)
[
imagrow
,
imagcol
]
=
find
(
abs
(
imag
(
jacob
))
>
1e-15
);
fprintf
(
'\nevaluate_steady_state: The Jacobian of the dynamic model contains imaginary parts. The problem arises from: \n\n'
)
display_problematic_vars_Jacobian
(
imagrow
,
imagcol
,
M
,
ys
,
'static'
,
'evaluate_steady_state: '
)
end
[
nanrow
,
nancol
]
=
find
(
isnan
(
jacob
));
if
~
isempty
(
nanrow
)
fprintf
(
'\nevaluate_steady_state: The Jacobian of the dynamic model contains NaN. The problem is associated with:\n\n'
)
display_problematic_vars_Jacobian
(
nanrow
,
nancol
,
M
,
ys
,
'static'
,
'evaluate_steady_state: '
)
end
end
%either if no steady state file or steady state file without problems
[
ys
,
params
,
info
]
=
dyn_ramsey_static
(
ys_init
,
M
,
options
,
oo
);
...
...
This diff is collapsed.
Click to expand it.
Johannes Pfeifer
@JohannesPfeifer
mentioned in commit
146e8c35
·
3 years ago
mentioned in commit
146e8c35
mentioned in commit 146e8c353f44f461c14a9d932495d1826971fc1c
Toggle commit list
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