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
42503e10
Verified
Commit
42503e10
authored
4 years ago
by
Willi Mutschler
Browse files
Options
Downloads
Patches
Plain Diff
Add unit tests for correct identification analysis
parent
b0fddeee
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1733
Identification bug fixes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/identification/BrockMirman/BrockMirman.mod
+36
-2
36 additions, 2 deletions
tests/identification/BrockMirman/BrockMirman.mod
tests/identification/kim/kim2.mod
+32
-1
32 additions, 1 deletion
tests/identification/kim/kim2.mod
with
68 additions
and
3 deletions
tests/identification/BrockMirman/BrockMirman.mod
+
36
−
2
View file @
42503e10
...
...
@@ -65,8 +65,42 @@ steady; % compute steady state given the starting values
resid; % check the starting values for the steady state
check; % check Blanchard & Khan rank condition
@#define CORRFLAG = 1
@#ifdef kronflag
identification(ar=3, useautocorr=
1
, nodisplay, nograph, parameter_set=calibration, analytic_derivation_mode=@{kronflag});
identification(ar=3, useautocorr=
@{CORRFLAG}
, nodisplay, nograph, parameter_set=calibration, analytic_derivation_mode=@{kronflag}
,tol_rank=1e-8
);
@#else
identification(ar=3, useautocorr=
1
, nodisplay, nograph, parameter_set=calibration, analytic_derivation_mode=0);
identification(ar=3, useautocorr=
@{CORRFLAG}
, nodisplay, nograph, parameter_set=calibration, analytic_derivation_mode=0
, tol_rank=1e-8
);
@#endif
% Unit test for correct identification results
load('BrockMirman/identification/BrockMirman_Current_params_identif.mat','ide_moments_point', 'ide_spectrum_point', 'ide_minimal_point', 'ide_reducedform_point')
pause(1);
chk.ind0 = [1 1 1 1 1];
chk.indno = [1 0 0 0 1];
chk.jweak = [1 0 0 0 1];
chk.jweak_pair = [0 0 0 0 0 0 0 0 0 0 1 0 0 0 0];
for strVars = {'ind0' 'indno' 'jweak' 'jweak_pair'}
if ~isequal(ide_moments_point.(strVars{:}) , chk.(strVars{:}))
disp('dMoments:')
disp(ide_moments_point.dMOMENTS);
disp(strVars{:})
disp(ide_moments_point.(strVars{:}));
error('identification based on moments is wrong for %s',strVars{:})
end
if ~isequal(ide_spectrum_point.(strVars{:}) , chk.(strVars{:}))
disp('dSPECTRUM');
disp(ide_spectrum_point.dSPECTRUM);
disp(strVars{:})
disp(ide_spectrum_point.(strVars{:}));
error('identification based on spectrum is wrong for %s',strVars{:})
end
if ~isequal(ide_minimal_point.(strVars{:}) , chk.(strVars{:}))
disp('dMINIMAL')
disp(ide_minimal_point.dMINIMAL);
disp(strVars{:})
disp(ide_minimal_point.(strVars{:}));
error('identification based on minimal system is wrong for %s',strVars{:})
end
end
This diff is collapsed.
Click to expand it.
tests/identification/kim/kim2.mod
+
32
−
1
View file @
42503e10
...
...
@@ -81,7 +81,7 @@ end;
varobs c i;
identification(advanced=1,max_dim_cova_group=3);
identification(advanced=1,max_dim_cova_group=3
,tol_rank=1e-8
);
//varobs c i lam; //to check if observing lam identifies phi and theta
//identification(ar=1,advanced=1,max_dim_cova_group=3,prior_mc=250);
//identification(prior_mc=100);
...
...
@@ -92,6 +92,37 @@ if store_options_ident.analytic_derivation~=1 && store_options_ident.analytic_de
error('the steady state file changed parameters and we should switch to numerical derivatives for the steady state, i.e. analytic_derivation_mode=-2')
end
% Unit test for correct identification results
load('kim2/identification/kim2_prior_mean_identif.mat','ide_moments_point', 'ide_spectrum_point', 'ide_minimal_point', 'ide_reducedform_point')
pause(1);
chk.ind0 = [1 1 1 0];
chk.indno = [0 0 0 1; 0 1 1 0];
chk.jweak = [0 1 1 0];
chk.jweak_pair = [0 0 0 0 1 0 0 0 0 0];
for strVars = {'ind0' 'indno' 'jweak' 'jweak_pair'}
if ~isequal(ide_moments_point.(strVars{:}) , chk.(strVars{:}))
disp('dMoments:')
disp(ide_moments_point.dMOMENTS);
disp(strVars{:})
disp(ide_moments_point.(strVars{:}));
error('identification based on moments is wrong for %s',strVars{:})
end
if ~isequal(ide_spectrum_point.(strVars{:}) , chk.(strVars{:}))
disp('dSPECTRUM');
disp(ide_spectrum_point.dSPECTRUM);
disp(strVars{:})
disp(ide_spectrum_point.(strVars{:}));
error('identification based on spectrum is wrong for %s',strVars{:})
end
if ~isequal(ide_minimal_point.(strVars{:}) , chk.(strVars{:}))
disp('dMINIMAL')
disp(ide_minimal_point.dMINIMAL);
disp(strVars{:})
disp(ide_minimal_point.(strVars{:}));
error('identification based on minimal system is wrong for %s',strVars{:})
end
end
% Integration test if identification works without priors
estim_params_=[];
identification(advanced=1,max_dim_cova_group=3);
This diff is collapsed.
Click to expand it.
Willi Mutschler
@wmutschl
mentioned in commit
64877b78
·
4 years ago
mentioned in commit
64877b78
mentioned in commit 64877b78e6f505764b6715dfb09243ee00c71ffd
Toggle commit list
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