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
98442b4e
Commit
98442b4e
authored
7 years ago
by
Stéphane Adjemian
Browse files
Options
Downloads
Patches
Plain Diff
Code factorization.
(cherry picked from commit
cc9e0ed0
)
parent
d77d5dd6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/set_parameters.m
+2
-49
2 additions, 49 deletions
matlab/set_parameters.m
with
2 additions
and
49 deletions
matlab/set_parameters.m
+
2
−
49
View file @
98442b4e
...
...
@@ -31,53 +31,6 @@ function set_parameters(xparam1)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global
estim_params_
M_
global
M_
nvx
=
estim_params_
.
nvx
;
ncx
=
estim_params_
.
ncx
;
nvn
=
estim_params_
.
nvn
;
ncn
=
estim_params_
.
ncn
;
np
=
estim_params_
.
np
;
Sigma_e
=
M_
.
Sigma_e
;
Correlation_matrix
=
M_
.
Correlation_matrix
;
offset
=
0
;
% setting shocks variance on the diagonal of Covariance matrix; used later
% for updating covariances
if
nvx
var_exo
=
estim_params_
.
var_exo
;
for
i
=
1
:
nvx
k
=
var_exo
(
i
,
1
);
Sigma_e
(
k
,
k
)
=
xparam1
(
i
)
^
2
;
end
end
% and update offset
offset
=
offset
+
nvx
+
nvn
;
% correlations amonx shocks (ncx)
if
ncx
corrx
=
estim_params_
.
corrx
;
for
i
=
1
:
ncx
k1
=
corrx
(
i
,
1
);
k2
=
corrx
(
i
,
2
);
Correlation_matrix
(
k1
,
k2
)
=
xparam1
(
i
+
offset
);
Correlation_matrix
(
k2
,
k1
)
=
Correlation_matrix
(
k1
,
k2
);
end
end
%build covariance matrix from correlation matrix and variances already on
%diagonal
Sigma_e
=
diag
(
sqrt
(
diag
(
Sigma_e
)))
*
Correlation_matrix
*
diag
(
sqrt
(
diag
(
Sigma_e
)));
if
isfield
(
estim_params_
,
'calibrated_covariances'
)
Sigma_e
(
estim_params_
.
calibrated_covariances
.
position
)
=
estim_params_
.
calibrated_covariances
.
cov_value
;
end
% and update offset
offset
=
offset
+
ncx
+
ncn
;
% structural parameters
if
np
M_
.
params
(
estim_params_
.
param_vals
(:,
1
))
=
xparam1
(
offset
+
1
:
end
);
end
M_
.
Sigma_e
=
Sigma_e
;
M_
.
Correlation_matrix
=
Correlation_matrix
;
M_
=
set_parameters_locally
(
M_
,
xparam1
);
\ No newline at end of file
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