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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Gauthier Vermandel
dynare
Commits
4d603fb3
Commit
4d603fb3
authored
2 years ago
by
Johannes Pfeifer
Browse files
Options
Downloads
Patches
Plain Diff
OccBin Smoother: do not write non-converged results to oo_
Closes
Dynare/dynare#1863
parent
1a665fbd
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
matlab/+occbin/DSGE_smoother.m
+14
-6
14 additions, 6 deletions
matlab/+occbin/DSGE_smoother.m
matlab/dynare_estimation_1.m
+8
-1
8 additions, 1 deletion
matlab/dynare_estimation_1.m
matlab/evaluate_smoother.m
+3
-1
3 additions, 1 deletion
matlab/evaluate_smoother.m
with
25 additions
and
8 deletions
matlab/+occbin/DSGE_smoother.m
+
14
−
6
View file @
4d603fb3
...
...
@@ -255,7 +255,7 @@ while is_changed && maxiter>iter && ~is_periodic
err_TT
(
iter
-
1
)
=
max
(
max
(
max
(
abs
(
TT
-
sto_TT
))));
end
if
occbin_smoother_debug
if
occbin_smoother_debug
||
is_periodic
regime_
=
cell
(
0
);
regime_new
=
regime_
;
start_
=
regime_
;
...
...
@@ -333,18 +333,26 @@ regime_history0(max(iter+1,1),:) = regime_history;
oo_
.
occbin
.
smoother
.
regime_history
=
regime_history0
(
end
,:);
oo_
.
occbin
.
smoother
.
regime_history_iter
=
regime_history0
;
if
occbin_smoother_debug
save
(
'info1'
,
'regime_history0'
)
save
(
'info1'
,
'regime_history0'
)
end
if
(
maxiter
==
iter
&&
is_changed
)
||
is_periodic
disp
([
'Occbin smoother did not converge.'
])
disp
(
'occbin.DSGE_smoother: smoother did not converge.'
)
fprintf
(
'occbin.DSGE_smoother: The algorithm did not reach a fixed point for the smoothed regimes.\n'
)
if
is_periodic
disp
([
'Occbin smoother algo loops between two solutions.'
])
oo_
.
occbin
.
smoother
.
error_flag
=
0
;
fprintf
(
'occbin.DSGE_smoother: For the periods indicated above, regimes loops between the "regime_" and the "regime_new_" pattern displayed above.\n'
)
fprintf
(
'occbin.DSGE_smoother: We provide smoothed shocks consistent with "regime_" in oo_.\n'
)
else
fprintf
(
'occbin.DSGE_smoother: The respective fields in oo_ will be left empty.\n'
)
oo_
.
occbin
.
smoother
=
[];
oo_
.
occbin
.
smoother
.
error_flag
=
1
;
end
else
disp
([
'Occbin smoother converged.'
])
disp
(
'occbin.DSGE_smoother: smoother converged.'
)
oo_
.
occbin
.
smoother
.
error_flag
=
0
;
if
occbin_smoother_fast
&&
is_changed_start
disp
(
'WARNING: fast algo is used, regime
(s)
duration
(s)
was not forced to converge'
)
disp
(
'
occbin.DSGE_smoother:
WARNING: fast algo is used, regime duration was not forced to converge'
)
end
end
if
(
~
is_changed
||
occbin_smoother_debug
)
&&
nargin
==
12
...
...
This diff is collapsed.
Click to expand it.
matlab/dynare_estimation_1.m
+
8
−
1
View file @
4d603fb3
...
...
@@ -185,10 +185,13 @@ if isequal(options_.mode_compute,0) && isempty(options_.mode_file) && ~options_.
else
if
options_
.
occbin
.
smoother
.
status
[
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
T
,
R
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
,
M_
,
oo_
,
bayestopt_
]
=
occbin
.
DSGE_smoother
(
xparam1
,
gend
,
transpose
(
data
),
data_index
,
missing_value
,
M_
,
oo_
,
options_
,
bayestopt_
,
estim_params_
,
dataset_
,
dataset_info
);
if
oo_
.
occbin
.
smoother
.
error_flag
==
0
[
oo_
]
=
store_smoother_results
(
M_
,
oo_
,
options_
,
bayestopt_
,
dataset_
,
dataset_info
,
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
);
end
else
[
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
T
,
R
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
,
M_
,
oo_
,
bayestopt_
]
=
DsgeSmoother
(
xparam1
,
gend
,
transpose
(
data
),
data_index
,
missing_value
,
M_
,
oo_
,
options_
,
bayestopt_
,
estim_params_
);
[
oo_
]
=
store_smoother_results
(
M_
,
oo_
,
options_
,
bayestopt_
,
dataset_
,
dataset_info
,
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
);
end
[
oo_
]
=
store_smoother_results
(
M_
,
oo_
,
options_
,
bayestopt_
,
dataset_
,
dataset_info
,
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
);
end
if
options_
.
forecast
>
0
oo_
.
forecast
=
dyn_forecast
(
var_list_
,
M_
,
options_
,
oo_
,
'smoother'
,
dataset_info
);
...
...
@@ -600,8 +603,12 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
else
if
options_
.
occbin
.
smoother
.
status
[
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
T
,
R
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
,
M_
,
oo_
,
bayestopt_
]
=
occbin
.
DSGE_smoother
(
xparam1
,
dataset_
.
nobs
,
transpose
(
dataset_
.
data
),
dataset_info
.
missing
.
aindex
,
dataset_info
.
missing
.
state
,
M_
,
oo_
,
options_
,
bayestopt_
,
estim_params_
,
dataset_
,
dataset_info
);
if
oo_
.
occbin
.
smoother
.
error_flag
==
0
[
oo_
,
yf
]
=
store_smoother_results
(
M_
,
oo_
,
options_
,
bayestopt_
,
dataset_
,
dataset_info
,
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
);
end
else
[
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
T
,
R
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
,
M_
,
oo_
,
bayestopt_
]
=
DsgeSmoother
(
xparam1
,
dataset_
.
nobs
,
transpose
(
dataset_
.
data
),
dataset_info
.
missing
.
aindex
,
dataset_info
.
missing
.
state
,
M_
,
oo_
,
options_
,
bayestopt_
,
estim_params_
);
[
oo_
,
yf
]
=
store_smoother_results
(
M_
,
oo_
,
options_
,
bayestopt_
,
dataset_
,
dataset_info
,
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
);
end
[
oo_
,
yf
]
=
store_smoother_results
(
M_
,
oo_
,
options_
,
bayestopt_
,
dataset_
,
dataset_info
,
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
);
end
...
...
This diff is collapsed.
Click to expand it.
matlab/evaluate_smoother.m
+
3
−
1
View file @
4d603fb3
...
...
@@ -120,7 +120,9 @@ else
DsgeSmoother
(
parameters
,
dataset_
.
nobs
,
transpose
(
dataset_
.
data
),
dataset_info
.
missing
.
aindex
,
dataset_info
.
missing
.
state
,
M_
,
oo_
,
options_
,
bayestopt_
,
estim_params_
);
end
if
~
(
options_
.
occbin
.
smoother
.
status
&&
options_
.
occbin
.
smoother
.
inversion_filter
)
[
oo_
]
=
store_smoother_results
(
M_
,
oo_
,
options_
,
bayestopt_
,
dataset_
,
dataset_info
,
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
);
if
~
options_
.
occbin
.
smoother
.
status
||
(
options_
.
occbin
.
smoother
.
status
&&
oo_
.
occbin
.
smoother
.
error_flag
==
0
)
[
oo_
]
=
store_smoother_results
(
M_
,
oo_
,
options_
,
bayestopt_
,
dataset_
,
dataset_info
,
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
,
aK
,
P
,
PK
,
decomp
,
Trend
,
state_uncertainty
);
end
else
[
oo_
]
=
store_smoother_results
(
M_
,
oo_
,
options_
,
bayestopt_
,
dataset_
,
dataset_info
,
atT
,
innov
,
measurement_error
,
updated_variables
,
ys
,
trend_coeff
);
end
...
...
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