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
Dynare
dynare
Commits
6dde1b1e
Commit
6dde1b1e
authored
Sep 29, 2017
by
Stéphane Adjemian
Browse files
Allow calibrated innovations with simul_backward_model routine.
parent
2d717dbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
matlab/backward/simul_backward_model.m
View file @
6dde1b1e
function
simulation
=
simul_backward_model
(
initialconditions
,
samplesize
,
DynareOptions
,
DynareModel
,
DynareOutput
,
innovations
)
function
simulation
=
simul_backward_model
(
initialconditions
,
samplesize
,
innovations
)
% Simulates a stochastic backward looking model (with arbitrary precision).
%
% INPUTS
% - initialconditions [double] n*1 vector, initial conditions for the endogenous variables.
% - samplesize [integer] scalar, number of periods for the simulation.
% - DynareOptions [struct] Dynare's options_ global structure.
% - DynareModel [struct] Dynare's M_ global structure.
% - DynareOutput [struct] Dynare's oo_ global structure.
% - innovations [double] T*q matrix, innovations to be used for the simulation.
% - innovations [dseries] innovations to be used for the simulation.
%
% OUTPUTS
% - simulation [dseries] Simulated endogenous and exogenous variables.
...
...
@@ -38,14 +35,36 @@ function simulation = simul_backward_model(initialconditions, samplesize, Dynare
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if
nargin
<
6
innovations
=
[];
end
global
options_
M_
oo_
%[initialconditions, samplesize, innovations, DynareOptions, DynareModel, DynareOutput] = simul_backward_model_init(varargin{:});
if
nargin
<
3
Innovations
=
[];
else
if
isdseries
(
innovations
)
if
isequal
(
innovations
.
dates
(
1
)
-
1
,
initialconditions
.
dates
(
end
))
if
innovations
.
nobs
<
samplesize
error
(
'Time span in third argument is too short (should not be less than %s, the value of the second argument)'
,
num2str
(
samplesize
))
end
% Set array holding innovations values.
Innovations
=
zeros
(
samplesize
,
M_
.
exo_nbr
);
exonames
=
cellstr
(
M_
.
exo_names
);
for
i
=
1
:
M_
.
exo_nbr
if
ismember
(
exonames
{
i
},
innovations
.
name
)
Innovations
(:,
i
)
=
innovations
{
exonames
{
i
}}
.
data
(
1
:
samplesize
);
else
disp
(
sprintf
(
'Exogenous variable %s is not available in third argument, default value is zero.'
,
exonames
{
i
}));
end
end
else
error
(
'Time spans in first and third arguments should be contiguous!'
)
end
else
error
(
'Third argument must be a dseries object!'
)
end
end
if
DynareO
ptions
.
linear
simulation
=
simul_backward_linear_model
(
initialconditions
,
samplesize
,
DynareO
ptions
,
DynareModel
,
DynareOutput
,
i
nnovations
);
if
o
ptions
_
.
linear
simulation
=
simul_backward_linear_model
(
initialconditions
,
samplesize
,
o
ptions
_
,
M_
,
oo_
,
I
nnovations
);
else
simulation
=
simul_backward_nonlinear_model
(
initialconditions
,
samplesize
,
DynareO
ptions
,
DynareModel
,
DynareOutput
,
i
nnovations
);
simulation
=
simul_backward_nonlinear_model
(
initialconditions
,
samplesize
,
o
ptions
_
,
M_
,
oo_
,
I
nnovations
);
end
\ No newline at end of file
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