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
Dóra Kocsis
dynare
Commits
c6a9650d
Commit
c6a9650d
authored
Sep 28, 2011
by
Marco Ratto
Browse files
Adapt identification routines after new dynare estimation commits.
parent
ebcc9d8f
Changes
5
Hide whitespace changes
Inline
Side-by-side
matlab/DsgeLikelihood.m
View file @
c6a9650d
...
...
@@ -476,10 +476,10 @@ if ((kalman_algo==1) || (kalman_algo==3))% Multivariate Kalman Filter
end
if
analytic_derivation
if
no_DLIK
==
0
[
DLIK
]
=
score
(
T
,
R
,
Q
,
H
,
Pstar
,
Y
,
DT
,
DYss
,
DOm
,
DH
,
DP
,
start
,
mf
,
kalman_tol
,
riccati_tol
);
[
DLIK
]
=
score
(
T
,
R
,
Q
,
H
,
Pstar
,
Y
,
DT
,
DYss
,
DOm
,
DH
,
DP
,
start
,
Z
,
kalman_tol
,
riccati_tol
);
end
if
nargout
==
7
[
AHess
]
=
AHessian
(
T
,
R
,
Q
,
H
,
Pstar
,
Y
,
DT
,
DYss
,
DOm
,
DH
,
DP
,
start
,
mf
,
kalman_tol
,
riccati_tol
);
if
nargout
==
11
[
AHess
]
=
AHessian
(
T
,
R
,
Q
,
H
,
Pstar
,
Y
,
DT
,
DYss
,
DOm
,
DH
,
DP
,
start
,
Z
,
kalman_tol
,
riccati_tol
);
end
end
else
...
...
matlab/dynare_estimation_init.m
View file @
c6a9650d
...
...
@@ -312,9 +312,9 @@ end % if ~isempty(options_.unit_root_vars)
% Test if the data file is declared.
if
isempty
(
options_
.
datafile
)
if
gsa_flag
data
=
[];
rawdata
=
[];
data_info
=
[];
data
set_
=
[];
%
rawdata = [];
%
data_info = [];
return
else
error
(
'datafile option is missing'
)
...
...
matlab/dynare_identification.m
View file @
c6a9650d
...
...
@@ -114,14 +114,26 @@ options_.nomoments=0;
options_
=
set_default_option
(
options_
,
'datafile'
,[]);
options_
.
mode_compute
=
0
;
options_
.
plot_priors
=
0
;
[
data
,
rawdata
,
xparam1
,
data_info
]
=
dynare_estimation_init
(
M_
.
endo_names
,
fname_
,
1
);
if
isempty
(
data_info
),
data_info
.
gend
=
periods
;
data_info
.
data
=
[];
data_info
.
data_index
=
[];
data_info
.
number_of_observations
=
periods
*
size
(
options_
.
varobs
,
1
);
data_info
.
no_more_missing_observations
=
0
;
data_info
.
missing_value
=
0
;
[
dataset_
,
xparam1
,
M_
,
options_
,
oo_
,
estim_params_
,
bayestopt_
]
=
dynare_estimation_init
(
M_
.
endo_names
,
fname_
,
1
,
M_
,
options_
,
oo_
,
estim_params_
,
bayestopt_
);
if
isempty
(
dataset_
),
dataset_
.
info
.
ntobs
=
periods
;
dataset_
.
info
.
nvobs
=
rows
(
options_
.
varobs
);
dataset_
.
info
.
varobs
=
options_
.
varobs
;
dataset_
.
rawdata
=
[];
dataset_
.
missing
.
state
=
0
;
dataset_
.
missing
.
aindex
=
[];
dataset_
.
missing
.
vindex
=
[];
dataset_
.
missing
.
number_of_observations
=
[];
dataset_
.
missing
.
no_more_missing_observations
=
[];
dataset_
.
descriptive
.
mean
=
[];
dataset_
.
data
=
[];
% data_info.gend = periods;
% data_info.data = [];
% data_info.data_index = [];
% data_info.number_of_observations = periods*size(options_.varobs,1);
% data_info.no_more_missing_observations = 0;
% data_info.missing_value = 0;
end
% results = prior_sampler(0,M_,bayestopt_,options_,oo_);
...
...
@@ -240,7 +252,7 @@ if iload <=0,
disp
(
'Testing current parameter values'
)
end
[
idehess_point
,
idemoments_point
,
idemodel_point
,
idelre_point
,
derivatives_info_point
]
=
...
identification_analysis
(
params
,
indx
,
indexo
,
options_ident
,
data
_info
,
prior_exist
,
name_tex
,
1
);
identification_analysis
(
params
,
indx
,
indexo
,
options_ident
,
data
set_
,
prior_exist
,
name_tex
,
1
);
idehess_point
.
params
=
params
;
% siH = idemodel_point.siH;
% siJ = idemoments_point.siJ;
...
...
@@ -274,7 +286,7 @@ if iload <=0,
params
=
prior_draw
();
end
[
dum1
,
ideJ
,
ideH
,
ideGP
,
dum2
,
info
]
=
...
identification_analysis
(
params
,
indx
,
indexo
,
options_MC
,
data
_info
,
prior_exist
,
name_tex
,
0
);
identification_analysis
(
params
,
indx
,
indexo
,
options_MC
,
data
set_
,
prior_exist
,
name_tex
,
0
);
if
iteration
==
0
,
MAX_tau
=
min
(
SampleSize
,
ceil
(
MaxNumberOfBytes
/(
size
(
ideH
.
siH
,
1
)
*
nparam
)/
8
));
stoH
=
zeros
([
size
(
ideH
.
siH
,
1
),
nparam
,
MAX_tau
]);
...
...
@@ -429,10 +441,10 @@ if SampleSize > 1,
fprintf
(
'\n'
)
tittxt
=
'Draw with HIGHEST condition number'
;
fprintf
(
'\n'
)
disp
([
'Testing '
,
tittxt
,
'. Press ENTER'
]),
pause
,
disp
([
'Testing '
,
tittxt
,
'. Press ENTER'
]),
pause
(
5
)
,
if
~
iload
,
[
idehess_max
,
idemoments_max
,
idemodel_max
,
idelre_max
,
derivatives_info_max
]
=
...
identification_analysis
(
pdraws
(
jmax
,:),
indx
,
indexo
,
options_ident
,
data
_info
,
prior_exist
,
name_tex
,
1
);
identification_analysis
(
pdraws
(
jmax
,:),
indx
,
indexo
,
options_ident
,
data
set_
,
prior_exist
,
name_tex
,
1
);
save
([
IdentifDirectoryName
'/'
M_
.
fname
'_identif.mat'
],
'idehess_max'
,
'idemoments_max'
,
'idemodel_max'
,
'idelre_max'
,
'jmax'
,
'-append'
);
end
disp_identification
(
pdraws
(
jmax
,:),
idemodel_max
,
idemoments_max
,
name
);
...
...
@@ -442,10 +454,10 @@ if SampleSize > 1,
fprintf
(
'\n'
)
tittxt
=
'Draw with SMALLEST condition number'
;
fprintf
(
'\n'
)
disp
([
'Testing '
,
tittxt
,
'. Press ENTER'
]),
pause
,
disp
([
'Testing '
,
tittxt
,
'. Press ENTER'
]),
pause
(
5
)
,
if
~
iload
,
[
idehess_min
,
idemoments_min
,
idemodel_min
,
idelre_min
,
derivatives_info_min
]
=
...
identification_analysis
(
pdraws
(
jmin
,:),
indx
,
indexo
,
options_ident
,
data
_info
,
prior_exist
,
name_tex
,
1
);
identification_analysis
(
pdraws
(
jmin
,:),
indx
,
indexo
,
options_ident
,
data
set_
,
prior_exist
,
name_tex
,
1
);
save
([
IdentifDirectoryName
'/'
M_
.
fname
'_identif.mat'
],
'idehess_min'
,
'idemoments_min'
,
'idemodel_min'
,
'idelre_min'
,
'jmin'
,
'-append'
);
end
disp_identification
(
pdraws
(
jmin
,:),
idemodel_min
,
idemoments_min
,
name
);
...
...
@@ -455,10 +467,10 @@ if SampleSize > 1,
for
j
=
1
:
length
(
jcrit
),
tittxt
=
[
'Rank deficient draw n. '
,
int2str
(
j
)];
fprintf
(
'\n'
)
disp
([
'Testing '
,
tittxt
,
'. Press ENTER'
]),
pause
,
disp
([
'Testing '
,
tittxt
,
'. Press ENTER'
]),
pause
(
5
)
,
if
~
iload
,
[
idehess_
(
j
),
idemoments_
(
j
),
idemodel_
(
j
),
idelre_
(
j
),
derivatives_info_
(
j
)]
=
...
identification_analysis
(
pdraws
(
jcrit
(
j
),:),
indx
,
indexo
,
options_ident
,
data
_info
,
prior_exist
,
name_tex
,
1
);
identification_analysis
(
pdraws
(
jcrit
(
j
),:),
indx
,
indexo
,
options_ident
,
data
set_
,
prior_exist
,
name_tex
,
1
);
end
disp_identification
(
pdraws
(
jcrit
(
j
),:),
idemodel_
(
j
),
idemoments_
(
j
),
name
);
close
all
,
...
...
matlab/identification_analysis.m
View file @
c6a9650d
...
...
@@ -129,13 +129,14 @@ if info(1)==0,
options_
.
irf
=
0
;
options_
.
noprint
=
1
;
options_
.
order
=
1
;
options_
.
periods
=
data_info
.
gend
+
100
;
options_
.
periods
=
data_info
.
info
.
ntobs
+
100
;
options_
.
kalman_algo
=
1
;
info
=
stoch_simul
(
options_
.
varobs
);
data
x
=
oo_
.
endo_simul
(
options_
.
varobs_id
,
100
+
1
:
end
);
data
_info
.
data
=
oo_
.
endo_simul
(
options_
.
varobs_id
,
100
+
1
:
end
);
% datax=data;
derivatives_info
.
no_DLIK
=
1
;
[
fval
,
cost_flag
,
ys
,
trend_coeff
,
info
,
DLIK
,
AHess
]
=
DsgeLikelihood
(
params
'
,
data_info
.
gend
,
datax
,
data_info
.
data_index
,
data_info
.
number_of_observations
,
data_info
.
no_more_missing_observations
,
derivatives_info
);
[
fval
,
cost_flag
,
ys
,
trend_coeff
,
info
,
M_
,
options_
,
bayestopt_
,
oo_
,
DLIK
,
AHess
]
=
DsgeLikelihood
(
params
'
,
data_info
,
options_
,
M_
,
estim_params_
,
bayestopt_
,
oo_
,
derivatives_info
);
% fval = DsgeLikelihood(xparam1,data_info,options_,M_,estim_params_,bayestopt_,oo_);
AHess
=-
AHess
;
ide_hess
.
AHess
=
AHess
;
deltaM
=
sqrt
(
diag
(
AHess
));
...
...
matlab/plot_identification.m
View file @
c6a9650d
...
...
@@ -94,7 +94,7 @@ if SampleSize == 1,
if
advanced
,
disp
(
' '
)
disp
(
'Press ENTER to display advanced diagnostics'
),
pause
,
disp
(
'Press ENTER to display advanced diagnostics'
),
pause
(
5
)
,
figure
(
'Name'
,[
tittxt
,
' - Sensitivity plot'
]),
subplot
(
211
)
mmm
=
(
siJnorm
)
'.
/
max
(
siJnorm
);
...
...
@@ -258,7 +258,7 @@ else
if
options_
.
nograph
,
close
(
gcf
);
end
if
advanced
,
disp
(
' '
)
disp
(
'Press ENTER to display advanced diagnostics'
),
pause
,
disp
(
'Press ENTER to display advanced diagnostics'
),
pause
(
5
)
,
options_
.
nograph
=
1
;
figure
(
'Name'
,
'MC Condition Number'
),
subplot
(
221
)
...
...
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