Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dynare
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Ratto
dynare
Commits
49dc9970
Verified
Commit
49dc9970
authored
Dec 20, 2019
by
Sébastien Villemot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Global reindentation of MATLAB code (excluding submodules)
Also convert to Unix end-of-lines, and remove trailing whitespaces.
parent
b901b7af
Changes
110
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
110 changed files
with
2158 additions
and
2168 deletions
+2158
-2168
matlab/PosteriorIRF_core2.m
matlab/PosteriorIRF_core2.m
+2
-2
matlab/accessors/get_irf.m
matlab/accessors/get_irf.m
+46
-47
matlab/accessors/get_mean.m
matlab/accessors/get_mean.m
+56
-56
matlab/accessors/get_shock_stderr_by_name.m
matlab/accessors/get_shock_stderr_by_name.m
+1
-1
matlab/accessors/get_smooth.m
matlab/accessors/get_smooth.m
+45
-46
matlab/accessors/get_update.m
matlab/accessors/get_update.m
+35
-36
matlab/backward/backward_model_forecast.m
matlab/backward/backward_model_forecast.m
+5
-5
matlab/backward/calibrateresiduals.m
matlab/backward/calibrateresiduals.m
+1
-1
matlab/backward/get_lags_on_endogenous_variables.m
matlab/backward/get_lags_on_endogenous_variables.m
+1
-1
matlab/backward/get_lags_on_exogenous_variables.m
matlab/backward/get_lags_on_exogenous_variables.m
+1
-1
matlab/backward/simul_backward_linear_model_.m
matlab/backward/simul_backward_linear_model_.m
+3
-3
matlab/backward/simul_backward_model_init.m
matlab/backward/simul_backward_model_init.m
+16
-16
matlab/cellofchararraymaxlength.m
matlab/cellofchararraymaxlength.m
+1
-1
matlab/commutation.m
matlab/commutation.m
+17
-17
matlab/compute_Pinf_Pstar.m
matlab/compute_Pinf_Pstar.m
+2
-2
matlab/compute_moments_varendo.m
matlab/compute_moments_varendo.m
+1
-1
matlab/conditional_variance_decomposition.m
matlab/conditional_variance_decomposition.m
+2
-2
matlab/conditional_variance_decomposition_ME_mc_analysis.m
matlab/conditional_variance_decomposition_ME_mc_analysis.m
+2
-2
matlab/conditional_variance_decomposition_mc_analysis.m
matlab/conditional_variance_decomposition_mc_analysis.m
+1
-1
matlab/convergence_diagnostics/McMCDiagnostics.m
matlab/convergence_diagnostics/McMCDiagnostics.m
+1
-1
matlab/convergence_diagnostics/raftery_lewis.m
matlab/convergence_diagnostics/raftery_lewis.m
+3
-3
matlab/cosn.m
matlab/cosn.m
+2
-2
matlab/cubature_with_gaussian_weight.m
matlab/cubature_with_gaussian_weight.m
+79
-79
matlab/discretionary_policy_1.m
matlab/discretionary_policy_1.m
+2
-2
matlab/disp_identification.m
matlab/disp_identification.m
+22
-22
matlab/disp_moments.m
matlab/disp_moments.m
+7
-7
matlab/disp_th_moments.m
matlab/disp_th_moments.m
+4
-4
matlab/display_conditional_variance_decomposition.m
matlab/display_conditional_variance_decomposition.m
+1
-1
matlab/display_problematic_vars_Jacobian.m
matlab/display_problematic_vars_Jacobian.m
+3
-3
matlab/dsge_likelihood.m
matlab/dsge_likelihood.m
+3
-3
matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m
...imulated_theoretical_conditional_variance_decomposition.m
+3
-3
matlab/dsge_simulated_theoretical_variance_decomposition.m
matlab/dsge_simulated_theoretical_variance_decomposition.m
+1
-1
matlab/duplication.m
matlab/duplication.m
+2
-2
matlab/dyn_second_order_solver.m
matlab/dyn_second_order_solver.m
+1
-1
matlab/dynare.m
matlab/dynare.m
+2
-2
matlab/dynare_config.m
matlab/dynare_config.m
+1
-1
matlab/dynare_estimation_1.m
matlab/dynare_estimation_1.m
+5
-5
matlab/dynare_estimation_init.m
matlab/dynare_estimation_init.m
+2
-2
matlab/dynare_identification.m
matlab/dynare_identification.m
+38
-38
matlab/dynare_solve.m
matlab/dynare_solve.m
+3
-3
matlab/dyntable.m
matlab/dyntable.m
+2
-2
matlab/ep/euler_equation_error.m
matlab/ep/euler_equation_error.m
+1
-1
matlab/ep/extended_path.m
matlab/ep/extended_path.m
+1
-1
matlab/epilogue_shock_decomposition.m
matlab/epilogue_shock_decomposition.m
+1
-3
matlab/evaluate_planner_objective.m
matlab/evaluate_planner_objective.m
+2
-2
matlab/fjaco.m
matlab/fjaco.m
+1
-1
matlab/get_identification_jacobians.m
matlab/get_identification_jacobians.m
+39
-39
matlab/get_minimal_state_representation.m
matlab/get_minimal_state_representation.m
+15
-15
matlab/get_perturbation_params_derivs.m
matlab/get_perturbation_params_derivs.m
+51
-52
matlab/get_perturbation_params_derivs_numerical_objective.m
matlab/get_perturbation_params_derivs_numerical_objective.m
+3
-3
matlab/get_variables_and_parameters_in_equation.m
matlab/get_variables_and_parameters_in_equation.m
+2
-2
matlab/graph_decomp.m
matlab/graph_decomp.m
+3
-3
matlab/graph_decomp_detail.m
matlab/graph_decomp_detail.m
+11
-11
matlab/gsa/pick.m
matlab/gsa/pick.m
+1
-1
matlab/gsa/redform_map.m
matlab/gsa/redform_map.m
+4
-4
matlab/ident_bruteforce.m
matlab/ident_bruteforce.m
+2
-2
matlab/identification_analysis.m
matlab/identification_analysis.m
+18
-18
matlab/identification_checks.m
matlab/identification_checks.m
+10
-10
matlab/identification_checks_via_subsets.m
matlab/identification_checks_via_subsets.m
+18
-18
matlab/identification_numerical_objective.m
matlab/identification_numerical_objective.m
+6
-6
matlab/imcforecast.m
matlab/imcforecast.m
+2
-2
matlab/initial_condition_decomposition.m
matlab/initial_condition_decomposition.m
+2
-2
matlab/isauxiliary.m
matlab/isauxiliary.m
+1
-1
matlab/isdiff.m
matlab/isdiff.m
+2
-2
matlab/mcforecast3.m
matlab/mcforecast3.m
+1
-1
matlab/missing/contains/contains.m
matlab/missing/contains/contains.m
+5
-5
matlab/missing/intersect_stable/intersect_stable.m
matlab/missing/intersect_stable/intersect_stable.m
+32
-32
matlab/missing/isfile/isfile.m
matlab/missing/isfile/isfile.m
+1
-1
matlab/missing/splitlines/splitlines.m
matlab/missing/splitlines/splitlines.m
+1
-1
matlab/missing/strjoin/strjoin.m
matlab/missing/strjoin/strjoin.m
+2
-3
matlab/mode_check.m
matlab/mode_check.m
+1
-1
matlab/model_inversion.m
matlab/model_inversion.m
+2
-2
matlab/occbin/evaluate_model.m
matlab/occbin/evaluate_model.m
+2
-2
matlab/occbin/get_coef.m
matlab/occbin/get_coef.m
+4
-4
matlab/occbin/get_complementarity_conditions.m
matlab/occbin/get_complementarity_conditions.m
+8
-9
matlab/occbin/get_occbin_complementarity_conditions.m
matlab/occbin/get_occbin_complementarity_conditions.m
+8
-9
matlab/occbin/occbin.m
matlab/occbin/occbin.m
+2
-2
matlab/occbin/solve_one_constraint.1.m
matlab/occbin/solve_one_constraint.1.m
+2
-2
matlab/optimization/cmaes.m
matlab/optimization/cmaes.m
+640
-640
matlab/optimization/dynare_minimize_objective.m
matlab/optimization/dynare_minimize_objective.m
+2
-2
matlab/optimization/gmhmaxlik_core.m
matlab/optimization/gmhmaxlik_core.m
+5
-5
matlab/optimization/simplex_optimization_routine.m
matlab/optimization/simplex_optimization_routine.m
+1
-1
matlab/optimization/simpsa.m
matlab/optimization/simpsa.m
+4
-4
matlab/optimization/solvopt.m
matlab/optimization/solvopt.m
+1
-1
matlab/osr1.m
matlab/osr1.m
+1
-1
matlab/parallel/AnalyseComputationalEnvironment.m
matlab/parallel/AnalyseComputationalEnvironment.m
+1
-1
matlab/parallel/masterParallel.m
matlab/parallel/masterParallel.m
+491
-491
matlab/partial_information/dr1_PI.m
matlab/partial_information/dr1_PI.m
+250
-250
matlab/perfect-foresight-models/private/initialize_stacked_problem.m
...ect-foresight-models/private/initialize_stacked_problem.m
+1
-1
matlab/plot_shock_decomposition.m
matlab/plot_shock_decomposition.m
+21
-21
matlab/posterior_analysis.m
matlab/posterior_analysis.m
+4
-4
matlab/posterior_sampler_core.m
matlab/posterior_sampler_core.m
+5
-5
matlab/posterior_sampler_initialization.m
matlab/posterior_sampler_initialization.m
+3
-3
matlab/posterior_sampler_iteration.m
matlab/posterior_sampler_iteration.m
+6
-6
matlab/print_moments_implied_prior.m
matlab/print_moments_implied_prior.m
+1
-1
matlab/prior_analysis.m
matlab/prior_analysis.m
+2
-2
matlab/set_parameters_locally.m
matlab/set_parameters_locally.m
+1
-1
matlab/set_prior.m
matlab/set_prior.m
+3
-3
matlab/slice_sampler.m
matlab/slice_sampler.m
+5
-5
matlab/squeeze_shock_decomposition.m
matlab/squeeze_shock_decomposition.m
+2
-2
matlab/steady.m
matlab/steady.m
+3
-3
matlab/unfold_g3.m
matlab/unfold_g3.m
+0
-1
matlab/unfold_g4.m
matlab/unfold_g4.m
+1
-1
matlab/uniform_specification.m
matlab/uniform_specification.m
+1
-1
matlab/utilities/dataset/makedataset.m
matlab/utilities/dataset/makedataset.m
+1
-1
matlab/utilities/general/demean.m
matlab/utilities/general/demean.m
+2
-2
matlab/utilities/graphics/distinguishable_colors.m
matlab/utilities/graphics/distinguishable_colors.m
+1
-1
matlab/variance_decomposition_ME_mc_analysis.m
matlab/variance_decomposition_ME_mc_analysis.m
+2
-2
matlab/variance_decomposition_mc_analysis.m
matlab/variance_decomposition_mc_analysis.m
+4
-4
matlab/write_latex_parameter_table.m
matlab/write_latex_parameter_table.m
+1
-1
No files found.
matlab/PosteriorIRF_core2.m
View file @
49dc9970
...
...
@@ -158,13 +158,13 @@ for i=fpar:npar
end
subplotnum
=
0
;
end
end
% loop over selected endo_var
end
% loop over selected endo_var
if
whoiam
fprintf
(
'Done! \n'
);
waitbarString
=
[
'Exog. shocks '
int2str
(
i
)
'/'
int2str
(
npar
)
' done.'
];
% fMessageStatus((i-fpar+1)/(npar-fpar+1),whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab));
dyn_waitbar
((
i
-
fpar
+
1
)/(
npar
-
fpar
+
1
),[],
waitbarString
);
end
end
% loop over exo_var
end
% loop over exo_var
myoutput
.
OutputFileName
=
OutputFileName
;
matlab/accessors/get_irf.m
View file @
49dc9970
function
y0
=
get_irf
(
exo
,
varargin
)
% function x = get_irf(exoname, vname1, vname2, ...)
% returns IRF to individual exogenous for a list of variables and adds the
% steady state
%
% INPUTS:
% exo: exo variable name
% vname1, vname2, ... : list of variable names
%
% OUTPUTS
% x: irf matrix [time x number of variables]
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2019 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global
M_
oo_
ys_
=
[
oo_
.
steady_state
];
y0
=
zeros
(
length
(
oo_
.
irfs
.
([
varargin
{
1
}
'_'
exo
]))
+
1
,
length
(
varargin
));
[
i_var
,
nvar
]
=
varlist_indices
(
varargin
,
M_
.
endo_names
);
for
j
=
1
:
nvar
% mfys = strmatch(varargin{j},lgy_,'exact');
y0
(:,
j
)
=
[
0
;
oo_
.
irfs
.
([
varargin
{
j
}
'_'
exo
])
'
]
+
ys_
(
i_var
(
j
));
end
function
y0
=
get_irf
(
exo
,
varargin
)
% function x = get_irf(exoname, vname1, vname2, ...)
% returns IRF to individual exogenous for a list of variables and adds the
% steady state
%
% INPUTS:
% exo: exo variable name
% vname1, vname2, ... : list of variable names
%
% OUTPUTS
% x: irf matrix [time x number of variables]
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2019 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global
M_
oo_
ys_
=
[
oo_
.
steady_state
];
y0
=
zeros
(
length
(
oo_
.
irfs
.
([
varargin
{
1
}
'_'
exo
]))
+
1
,
length
(
varargin
));
[
i_var
,
nvar
]
=
varlist_indices
(
varargin
,
M_
.
endo_names
);
for
j
=
1
:
nvar
% mfys = strmatch(varargin{j},lgy_,'exact');
y0
(:,
j
)
=
[
0
;
oo_
.
irfs
.
([
varargin
{
j
}
'_'
exo
])
'
]
+
ys_
(
i_var
(
j
));
end
matlab/accessors/get_mean.m
View file @
49dc9970
function
y0
=
get_mean
(
varargin
)
% function x = get_mean(vname1, vname2, <order>)
% returns the steady-state of a variable identified by its name
%
% INPUTS:
% vname1, vname2, ... : list of variable names
% order: if integer 1 or 2, optionally last input can trigger the order
% at which steady state is computed
%
% OUTPUTS
% x: steady state values
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2019 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global
M_
oo_
options_
if
~
isempty
(
regexp
(
varargin
{
end
},
'\d'
,
'ONCE'
))
&&
isempty
(
regexp
(
varargin
{
end
},
'\D'
,
'ONCE'
))
order
=
eval
(
varargin
{
end
});
else
order
=
1
;
end
if
order
==
1
ys_
=
oo_
.
steady_state
;
ys_
=
evaluate_steady_state
(
ys_
,
M_
,
options_
,
oo_
,
1
);
elseif
order
==
2
ys_
=
oo_
.
dr
.
ys
;
ys_
(
oo_
.
dr
.
order_var
)
=
ys_
(
oo_
.
dr
.
order_var
)
+
oo_
.
dr
.
ghs2
.
/
2
;
else
return
end
lgy_
=
M_
.
endo_names
;
mfys
=
nan
(
length
(
varargin
),
1
);
for
j
=
1
:
length
(
varargin
)
mfys
(
j
)
=
find
(
strcmp
(
varargin
{
j
},
lgy_
));
end
y0
=
ys_
(
mfys
);
function
y0
=
get_mean
(
varargin
)
% function x = get_mean(vname1, vname2, <order>)
% returns the steady-state of a variable identified by its name
%
% INPUTS:
% vname1, vname2, ... : list of variable names
% order: if integer 1 or 2, optionally last input can trigger the order
% at which steady state is computed
%
% OUTPUTS
% x: steady state values
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2019 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global
M_
oo_
options_
if
~
isempty
(
regexp
(
varargin
{
end
},
'\d'
,
'ONCE'
))
&&
isempty
(
regexp
(
varargin
{
end
},
'\D'
,
'ONCE'
))
order
=
eval
(
varargin
{
end
});
else
order
=
1
;
end
if
order
==
1
ys_
=
oo_
.
steady_state
;
ys_
=
evaluate_steady_state
(
ys_
,
M_
,
options_
,
oo_
,
1
);
elseif
order
==
2
ys_
=
oo_
.
dr
.
ys
;
ys_
(
oo_
.
dr
.
order_var
)
=
ys_
(
oo_
.
dr
.
order_var
)
+
oo_
.
dr
.
ghs2
.
/
2
;
else
return
end
lgy_
=
M_
.
endo_names
;
mfys
=
nan
(
length
(
varargin
),
1
);
for
j
=
1
:
length
(
varargin
)
mfys
(
j
)
=
find
(
strcmp
(
varargin
{
j
},
lgy_
));
end
y0
=
ys_
(
mfys
);
matlab/accessors/get_shock_stderr_by_name.m
View file @
49dc9970
function
x
=
get_shock_stderr_by_name
(
exoname
)
% function x = get_shock_stderr_by_name(exoname)
% returns the value of a shock identified by its name
%
%
% INPUTS:
% exoname: shock name
%
...
...
matlab/accessors/get_smooth.m
View file @
49dc9970
function
y0
=
get_smooth
(
varargin
)
% function x = get_smooth(vname1, vname2, )
% returns smoothed variables or shocks identified by their name
%
% INPUTS:
% vname1, vname2, ... : list of variable/shock names
%
% OUTPUTS
% x: smoothed variables [T x number of variables]
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2019 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global
oo_
SmoothedVariables
=
[
struct2cell
(
oo_
.
SmoothedVariables
);
struct2cell
(
oo_
.
SmoothedShocks
)];
my_field_names
=
[
fieldnames
(
oo_
.
SmoothedVariables
);
fieldnames
(
oo_
.
SmoothedShocks
)];
isvar
=
zeros
(
length
(
SmoothedVariables
),
1
);
for
jf
=
1
:
length
(
SmoothedVariables
)
isvar
(
jf
)
=~
(
isstruct
(
SmoothedVariables
{
jf
}));
end
SmoothedVariables
=
cell2struct
(
SmoothedVariables
(
logical
(
isvar
)),
my_field_names
(
logical
(
isvar
)));
y0
=
zeros
(
length
(
SmoothedVariables
.
(
varargin
{
1
})),
length
(
varargin
));
for
j
=
1
:
length
(
varargin
)
y0
(:,
j
)
=
SmoothedVariables
.
(
varargin
{
j
});
end
function
y0
=
get_smooth
(
varargin
)
% function x = get_smooth(vname1, vname2, )
% returns smoothed variables or shocks identified by their name
%
% INPUTS:
% vname1, vname2, ... : list of variable/shock names
%
% OUTPUTS
% x: smoothed variables [T x number of variables]
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2019 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global
oo_
SmoothedVariables
=
[
struct2cell
(
oo_
.
SmoothedVariables
);
struct2cell
(
oo_
.
SmoothedShocks
)];
my_field_names
=
[
fieldnames
(
oo_
.
SmoothedVariables
);
fieldnames
(
oo_
.
SmoothedShocks
)];
isvar
=
zeros
(
length
(
SmoothedVariables
),
1
);
for
jf
=
1
:
length
(
SmoothedVariables
)
isvar
(
jf
)
=~
(
isstruct
(
SmoothedVariables
{
jf
}));
end
SmoothedVariables
=
cell2struct
(
SmoothedVariables
(
logical
(
isvar
)),
my_field_names
(
logical
(
isvar
)));
y0
=
zeros
(
length
(
SmoothedVariables
.
(
varargin
{
1
})),
length
(
varargin
));
for
j
=
1
:
length
(
varargin
)
y0
(:,
j
)
=
SmoothedVariables
.
(
varargin
{
j
});
end
matlab/accessors/get_update.m
View file @
49dc9970
function
y0
=
get_update
(
varargin
)
% function x = get_update(vname1, vname2, )
% returns updated variables identified by their name
%
% INPUTS:
% vname1, vname2, ... : list of variable names
%
% OUTPUTS
% x: smoothed variables [T x number of variables]
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2019 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global
oo_
y0
=
zeros
(
length
(
oo_
.
UpdatedVariables
.
(
varargin
{
1
})),
length
(
varargin
));
for
j
=
1
:
length
(
varargin
)
y0
(:,
j
)
=
oo_
.
UpdatedVariables
.
(
varargin
{
j
});
end
function
y0
=
get_update
(
varargin
)
% function x = get_update(vname1, vname2, )
% returns updated variables identified by their name
%
% INPUTS:
% vname1, vname2, ... : list of variable names
%
% OUTPUTS
% x: smoothed variables [T x number of variables]
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2019 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global
oo_
y0
=
zeros
(
length
(
oo_
.
UpdatedVariables
.
(
varargin
{
1
})),
length
(
varargin
));
for
j
=
1
:
length
(
varargin
)
y0
(:,
j
)
=
oo_
.
UpdatedVariables
.
(
varargin
{
j
});
end
matlab/backward/backward_model_forecast.m
View file @
49dc9970
...
...
@@ -2,13 +2,13 @@ function forecasts = backward_model_forecast(initialcondition, listofvariables,
% Returns unconditional forecasts.
%
% INPUTS
% INPUTS
% - initialcondition [dseries] Initial conditions for the endogenous variables.
% - periods [integer] scalar, the number of (forecast) periods.
% - withuncertainty [logical] scalar, returns confidence bands if true.
%
% OUTPUTS
% - forecast [dseries]
% OUTPUTS
% - forecast [dseries]
% Copyright (C) 2017-2018 Dynare Team
%
...
...
@@ -98,7 +98,7 @@ end
forecasts
.
pointforecast
=
dseries
(
transpose
(
ysim__0
(
idy
,:)),
initialcondition
.
init
,
listofvariables
);
% Set first period of forecast
forecasts
.
start
=
start
;
forecasts
.
start
=
start
;
if
withuncertainty
% Preallocate an array gathering the simulations.
...
...
@@ -110,7 +110,7 @@ if withuncertainty
else
[
ysim__
,
xsim__
]
=
simul_backward_nonlinear_model_
(
initialcondition
,
periods
,
DynareOptions
,
DynareModel
,
DynareOutput
,
innovations
,
iy1
,
model_dynamic
);
end
ArrayOfForecasts
(:,:,
i
)
=
ysim__
(
idy
,:);
ArrayOfForecasts
(:,:,
i
)
=
ysim__
(
idy
,:);
end
% Compute mean (over future uncertainty) forecast.
forecasts
.
meanforecast
=
dseries
(
transpose
(
mean
(
ArrayOfForecasts
,
3
)),
initialcondition
.
init
,
listofvariables
);
...
...
matlab/backward/calibrateresiduals.m
View file @
49dc9970
...
...
@@ -45,7 +45,7 @@ ydata = dbase{info.endonames{:}}.data;
exogenousvariablesindbase
=
intersect
(
info
.
exonames
,
dbase
.
name
);
residuals
=
dseries
(
NaN
(
dbase
.
nobs
,
length
(
info
.
residuals
)),
dbase
.
init
,
info
.
residuals
);
allexogenousvariables
=
[
dbase
{
exogenousvariablesindbase
{:}},
residuals
];
allexogenousvariables
=
allexogenousvariables
{
info
.
exonames
{:}};
allexogenousvariables
=
allexogenousvariables
{
info
.
exonames
{:}};
xdata
=
allexogenousvariables
.
data
;
% Evaluate the dynamic equation
...
...
matlab/backward/get_lags_on_endogenous_variables.m
View file @
49dc9970
function
l
=
get_lags_on_endogenous_variables
(
DynareModel
)
% Returns a vector with the max lag for each endogenous variable.
% Returns a vector with the max lag for each endogenous variable.
% Copyright (C) 2017 Dynare Team
%
...
...
matlab/backward/get_lags_on_exogenous_variables.m
View file @
49dc9970
function
l
=
get_lags_on_exogenous_variables
(
DynareModel
)
% Returns a vector with the max lag for each exogenous variable.
% Returns a vector with the max lag for each exogenous variable.
% Copyright (C) 2017 Dynare Team
%
...
...
matlab/backward/simul_backward_linear_model_.m
View file @
49dc9970
...
...
@@ -44,9 +44,9 @@ end
% Get coefficients
[
cst
,
jacob
]
=
model_dynamic
(
zeros
(
DynareModel
.
endo_nbr
+
ny1
,
1
),
...
zeros
(
DynareModel
.
orig_maximum_lag
+
1
,
DynareModel
.
exo_nbr
),
...
DynareModel
.
params
,
...
DynareOutput
.
steady_state
,
DynareModel
.
orig_maximum_lag
+
1
);
zeros
(
DynareModel
.
orig_maximum_lag
+
1
,
DynareModel
.
exo_nbr
),
...
DynareModel
.
params
,
...
DynareOutput
.
steady_state
,
DynareModel
.
orig_maximum_lag
+
1
);
A0inv
=
inv
(
jacob
(:,
jdx
));
A1
=
jacob
(:,
nonzeros
(
DynareModel
.
lead_lag_incidence
(
1
,:)));
...
...
matlab/backward/simul_backward_model_init.m
View file @
49dc9970
function
[
initialconditions
,
samplesize
,
innovations
,
DynareOptions
,
DynareModel
,
DynareOutput
,
endonames
,
exonames
,
nx
,
ny1
,
iy1
,
jdx
,
model_dynamic
,
y
]
=
...
simul_backward_model_init
(
initialconditions
,
samplesize
,
DynareOptions
,
DynareModel
,
DynareOutput
,
innovations
)
% Initialization of the routines simulating backward models.
% Initialization of the routines simulating backward models.
% Copyright (C) 2017-2019 Dynare Team
%
...
...
@@ -67,7 +67,7 @@ endolags_ = endolags(find(endolags));
endowithlagnames
=
endonames
(
find
(
endolags
));
if
~
isempty
(
missingendogenousvariables
)
missingendogenousvariables
=
setdiff
(
endowithlagnames
,
initialconditions
.
name
);
missingendogenouslaggedvariables
=
intersect
(
endowithlagnames
,
missingendogenousvariables
);
missingendogenouslaggedvariables
=
intersect
(
endowithlagnames
,
missingendogenousvariables
);
if
~
isempty
(
missingendogenouslaggedvariables
)
disp
(
'You have to initialize the following endogenous variables:'
)
msg
=
sprintf
(
'%s\n'
,
missingendogenouslaggedvariables
{
1
:
end
-
1
});
...
...
@@ -83,7 +83,7 @@ maxlag = abs(min(endolags));
if
maxlag
>
initialconditions
.
nobs
error
(
'The dseries object provided as first input argument should at least have %s periods!'
,
num2str
(
maxlag
))
end
missinginitialcondition
=
false
;
missinginitialcondition
=
false
;
for
i
=
1
:
length
(
endowithlagnames
)
lags
=
abs
(
endolags_
(
i
));
variable
=
initialconditions
{
endowithlagnames
{
i
}};
...
...
@@ -102,7 +102,7 @@ if missinginitialcondition
error
(
'Please fix the dseries object used for setting the initial conditions!'
)
end
% If the model has lags on the exogenous variables, test if we have corresponding initial conditions.
% If the model has lags on the exogenous variables, test if we have corresponding initial conditions.
exonames
=
DynareModel
.
exo_names
;
missingexogenousvariables
=
setdiff
(
exonames
,
initialconditions
.
name
);
exolags
=
get_lags_on_exogenous_variables
(
DynareModel
);
...
...
@@ -110,7 +110,7 @@ exolags_ = exolags(find(exolags));
exowithlagnames
=
exonames
(
find
(
exolags
));
if
~
isempty
(
missingexogenousvariables
)
missingexogenousvariables
=
setdiff
(
exowithlagnames
,
initialconditions
.
name
);
missingexogenouslaggedvariables
=
intersect
(
exowithlagnames
,
missingexogenousvariables
);
missingexogenouslaggedvariables
=
intersect
(
exowithlagnames
,
missingexogenousvariables
);
if
~
isempty
(
missingexogenouslaggedvariables
)
disp
(
'You have to initialize the following exogenous variables:'
)
msg
=
sprintf
(
'%s\n'
,
missingexogenouslaggedvariables
{
1
:
end
-
1
});
...
...
@@ -126,7 +126,7 @@ maxlag = abs(min(exolags));
if
maxlag
>
initialconditions
.
nobs
error
(
'The dseries object provided as first input argument should at least have %s periods!'
,
num2str
(
maxlag
))
end
missinginitialcondition
=
false
;
missinginitialcondition
=
false
;
for
i
=
1
:
length
(
exowithlagnames
)
lags
=
abs
(
exolags_
(
i
));
variable
=
initialconditions
{
exowithlagnames
{
i
}};
...
...
@@ -190,14 +190,14 @@ end
if
nargout
>
8
nx
=
size
(
DynareOutput
.
exo_simul
,
2
);
ny0
=
nnz
(
DynareModel
.
lead_lag_incidence
(
2
,:));
ny1
=
nnz
(
DynareModel
.
lead_lag_incidence
(
1
,:));
iy1
=
find
(
DynareModel
.
lead_lag_incidence
(
1
,:)
>
0
);
idx
=
1
:
DynareModel
.
endo_nbr
;
jdx
=
idx
+
ny1
;
% Get the name of the dynamic model routine.
model_dynamic
=
str2func
([
DynareModel
.
fname
,
'.dynamic'
]);
% initialization of vector y.
y
=
NaN
(
length
(
idx
)
+
ny1
,
1
);
nx
=
size
(
DynareOutput
.
exo_simul
,
2
);
ny0
=
nnz
(
DynareModel
.
lead_lag_incidence
(
2
,:));
ny1
=
nnz
(
DynareModel
.
lead_lag_incidence
(
1
,:));
iy1
=
find
(
DynareModel
.
lead_lag_incidence
(
1
,:)
>
0
);
idx
=
1
:
DynareModel
.
endo_nbr
;
jdx
=
idx
+
ny1
;
% Get the name of the dynamic model routine.
model_dynamic
=
str2func
([
DynareModel
.
fname
,
'.dynamic'
]);
% initialization of vector y.
y
=
NaN
(
length
(
idx
)
+
ny1
,
1
);
end
\ No newline at end of file
matlab/cellofchararraymaxlength.m
View file @
49dc9970
function
n
=
cellofchararraymaxlength
(
c
)
% Copyright (C) 2018 Dynare Team
%
% This file is part of Dynare.
...
...
matlab/commutation.m
View file @
49dc9970
function
k
=
commutation
(
n
,
m
,
sparseflag
)
% k = commutation(n, m, sparseflag)
% -------------------------------------------------------------------------
% Returns Magnus and Neudecker's commutation matrix of dimensions n by m,
% Returns Magnus and Neudecker's commutation matrix of dimensions n by m,
% that solves k*vec(X)=vec(X')
% =========================================================================
% INPUTS
...
...
@@ -10,9 +10,9 @@ function k = commutation(n, m, sparseflag)
% sparseflag: [integer] whether to use sparse matrices (=1) or not (else)
% -------------------------------------------------------------------------
% OUTPUTS
% k: [n by m] commutation matrix
% k: [n by m] commutation matrix
% -------------------------------------------------------------------------
% This function is called by
% This function is called by
% * get_perturbation_params_derivs.m (previously getH.m)
% * get_identification_jacobians.m (previously getJJ.m)
% -------------------------------------------------------------------------
...
...
@@ -40,25 +40,25 @@ function k = commutation(n, m, sparseflag)
% Original author: Thomas P Minka (tpminka@media.mit.edu), April 22, 2013
if
nargin
<
2
m
=
n
(
2
);
n
=
n
(
1
);
m
=
n
(
2
);
n
=
n
(
1
);
end
if
nargin
<
3
sparseflag
=
0
;
sparseflag
=
0
;
end
if
0
% first method
i
=
1
:(
n
*
m
);