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
35a25b8f
Commit
35a25b8f
authored
2 years ago
by
Johannes Pfeifer
Browse files
Options
Downloads
Patches
Plain Diff
dyn_forecast.m: gracefully exit if decision rules and remove unused output argument
parent
4195fa77
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!2051
dyn_forecast: fix documentation and error handling
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
matlab/dyn_forecast.m
+20
-12
20 additions, 12 deletions
matlab/dyn_forecast.m
tests/smoother2histval/fs2000_smooth_ML.mod
+1
-1
1 addition, 1 deletion
tests/smoother2histval/fs2000_smooth_ML.mod
with
21 additions
and
13 deletions
matlab/dyn_forecast.m
+
20
−
12
View file @
35a25b8f
function
[
forecast
,
info
]
=
dyn_forecast
(
var_list
,
M
,
options
,
oo
,
task
,
dataset_info
)
% function dyn_forecast(var_list,M,options,oo,task,dataset_info)
function
forecast
=
dyn_forecast
(
var_list
,
M
,
options
,
oo
,
task
,
dataset_info
)
% function
forecast =
dyn_forecast(var_list,M,options,oo,task,dataset_info)
% computes mean forecast for a given value of the parameters
% compues also confidence band for the forecast
% compu
t
es also confidence band
s
for the forecast
%
% INPUTS
% var_list: list of variables (character matrix)
...
...
@@ -13,15 +13,21 @@ function [forecast,info] = dyn_forecast(var_list,M,options,oo,task,dataset_info)
% dataset_info: Various informations about the dataset (descriptive statistics and missing observations).
% OUTPUTS
% nothing is returned but the procedure saves output
% in oo_.forecast.Mean
% oo_.forecast.HPDinf
% oo_.forecast.HPDsup
%
% forecast: structure containing fields
% Mean: point estimate
% HPDinf: lower bound of confidence band, ignoring
% measurement error
% HPDsup: upper bound of confidence band, ignoring
% measurement error
% HPDinf_ME: lower bound of confidence band, accounting
% for measurement error
% HPDsup_ME: upper bound of confidence band, accounting
% for measurement error
% Exogenous: path for var_exo_det
% SPECIAL REQUIREMENTS
% none
% Copyright © 2003-20
18
Dynare Team
% Copyright © 2003-20
22
Dynare Team
%
% This file is part of Dynare.
%
...
...
@@ -38,14 +44,16 @@ function [forecast,info] = dyn_forecast(var_list,M,options,oo,task,dataset_info)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
if
~
isfield
(
oo
,
'dr'
)
||
isempty
(
oo
.
dr
)
error
(
'dyn_forecast: the decision rules have not been computed. Did you forget a stoch_simul-command?'
)
end
if
nargin
<
6
&&
options
.
prefilter
error
(
'The prefiltering option is not allowed without providing a dataset'
)
elseif
nargin
==
6
mean_varobs
=
dataset_info
.
descriptive
.
mean
'
;
end
info
=
0
;
oo
=
make_ex_
(
M
,
options
,
oo
);
maximum_lag
=
M
.
maximum_lag
;
...
...
@@ -205,4 +213,4 @@ end
if
~
options
.
nograph
oo
.
forecast
=
forecast
;
forecast_graphs
(
var_list
,
M
,
oo
,
options
)
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/smoother2histval/fs2000_smooth_ML.mod
+
1
−
1
View file @
35a25b8f
...
...
@@ -90,7 +90,7 @@ smoother2histval;
forecast;
forecast_smoother2histval=oo_.forecast;
[forecast_smoother
,info
] = dyn_forecast(var_list_,M_,options_,oo_,'smoother');
[forecast_smoother] = dyn_forecast(var_list_,M_,options_,oo_,'smoother');
if max(abs(struct2array(forecast_estimation.Mean)-struct2array(forecast_smoother2histval.Mean)))>1e-6
error('Forecasts do not match')
...
...
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