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
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
Sumudu Kankanamge
dynare
Commits
aa66949a
Commit
aa66949a
authored
Apr 12, 2019
by
Sumudu Kankanamge
🤔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
read JSON for stochastic simulations from GUI
parent
2dc988b6
Pipeline
#1128
failed with stages
in 74 minutes and 31 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
0 deletions
+79
-0
matlab/+gui/+stochastic-simulation/read.m
matlab/+gui/+stochastic-simulation/read.m
+79
-0
No files found.
matlab/+gui/+stochastic-simulation/read.m
0 → 100644
View file @
aa66949a
function
run
(
json
)
% function varargout = run(json)
% Read JSON and run perfect foresight solver. Potentially return output as
% JSON
%
% INPUTS
% json [string] JSON string representing options to run perfect
% foresight solver
%
% OUTPUTS
% none
%
% 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_
options_
oo_
%loading JSON
jm
=
loadjson
(
json
,
'SimplifyCell'
,
1
);
runflag
=
1
;
data2json
=
struct
();
M_
.
exo_det_length
=
0
;
for
nshocks
=
1
:
length
(
jm
.
stochasticshocksdescription
)
covartype
=
jm
.
stochasticshocksdescription
{
nshocks
}
.
shockattributevalue
;
thisshock
=
(
jm
.
stochasticshocksdescription
{
nshocks
}
.
shockindex
)
+
1
;
assoshock
=
(
jm
.
stochasticshocksdescription
{
nshocks
}
.
assoshockindex
)
+
1
;
switch
covartype
case
1
M_
.
Sigma_e
(
thisshock
,
thisshock
)
=
(
jm
.
stochasticshocksdescription
{
nshocks
}
.
shockvalue
)
^
2
;
case
2
M_
.
Sigma_e
(
thisshock
,
thisshock
)
=
jm
.
stochasticshocksdescription
{
nshocks
}
.
shockvalue
;
case
3
M_
.
Sigma_e
(
thisshock
,
assoshock
)
=
jm
.
stochasticshocksdescription
{
nshocks
}
.
shockvalue
;
M_
.
Sigma_e
(
assoshock
,
thisshock
)
=
M_
.
Sigma_e
(
thisshock
,
assoshock
);
M_
.
sigma_e_is_diagonal
=
0
;
case
4
M_
.
Sigma_e
(
thisshock
,
assoshock
)
=
2
*
sqrt
(
M_
.
Sigma_e
(
thisshock
,
thisshock
)
*
M_
.
Sigma_e
(
assoshock
,
assoshock
));
M_
.
Sigma_e
(
assoshock
,
thisshock
)
=
M_
.
Sigma_e
(
thisshock
,
assoshock
);
M_
.
Correlation_matrix
(
thisshock
,
assoshock
)
=
jm
.
stochasticshocksdescription
{
nshocks
}
.
shockvalue
;
M_
.
Correlation_matrix
(
assoshock
,
thisshock
)
=
M_
.
Correlation_matrix
(
thisshock
,
assoshock
);
M_
.
sigma_e_is_diagonal
=
0
;
end
end
options_
.
irf
=
jm
.
irfperiods
;
options_
.
nograph
=
1
;
options_
.
order
=
jm
.
taylororder
;
% if jm.taylororder==3
% options_.k_order_solver = 3;
% end
var_list_
=
char
();
info
=
stoch_simul
(
var_list_
);
irfnames
=
fieldnames
(
oo_
.
irfs
);
for
jj
=
1
:
numel
(
fieldnames
(
oo_
.
irfs
))
data2json
.
irfs
.
(
strtrim
(
char
(
irfnames
(
jj
))))
=
oo_
.
irfs
.
(
irfnames
{
jj
});
end
savejson
(
''
,
data2json
,
'stochsimout.JSON'
);
return
;
Write
Preview
Markdown
is supported
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