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
ecac8714
Commit
ecac8714
authored
Dec 26, 2011
by
Stéphane Adjemian
Browse files
Changed the name of DsgeLikelihood (-> dsge_likelihood).
parent
45d85f19
Changes
11
Hide whitespace changes
Inline
Side-by-side
matlab/
D
sge
L
ikelihood.m
→
matlab/
d
sge
_l
ikelihood.m
View file @
ecac8714
function
[
fval
,
exit_flag
,
ys
,
trend_coeff
,
info
,
Model
,
DynareOptions
,
BayesInfo
,
DynareResults
,
DLIK
,
AHess
]
=
D
sge
L
ikelihood
(
xparam1
,
DynareDataset
,
DynareOptions
,
Model
,
EstimatedParameters
,
BayesInfo
,
DynareResults
,
derivatives_info
)
function
[
fval
,
exit_flag
,
ys
,
trend_coeff
,
info
,
Model
,
DynareOptions
,
BayesInfo
,
DynareResults
,
DLIK
,
AHess
]
=
d
sge
_l
ikelihood
(
xparam1
,
DynareDataset
,
DynareOptions
,
Model
,
EstimatedParameters
,
BayesInfo
,
DynareResults
,
derivatives_info
)
%
Evaluates
the
posterior
kernel
of
a
dsge
model
.
%
Evaluates
the
posterior
kernel
of
a
dsge
model
.
%
@info
:
%
@info
:
%!
@deftypefn
{
Function
File
}
{[
@var
{
fval
},
@var
{
exit_flag
},
@var
{
ys
},
@var
{
trend_coeff
},
@var
{
info
},
@var
{
Model
},
@var
{
DynareOptions
},
@var
{
BayesInfo
},
@var
{
DynareResults
},
@var
{
DLIK
},
@var
{
AHess
}]
=
}
DsgeLikelihood
(
@var
{
xparam1
},
@var
{
DynareDataset
},
@var
{
DynareOptions
},
@var
{
Model
},
@var
{
EstimatedParameters
},
@var
{
BayesInfo
},
@var
{
DynareResults
},
@var
{
derivatives_flag
})
%!
@deftypefn
{
Function
File
}
{[
@var
{
fval
},
@var
{
exit_flag
},
@var
{
ys
},
@var
{
trend_coeff
},
@var
{
info
},
@var
{
Model
},
@var
{
DynareOptions
},
@var
{
BayesInfo
},
@var
{
DynareResults
},
@var
{
DLIK
},
@var
{
AHess
}]
=
}
DsgeLikelihood
(
@var
{
xparam1
},
@var
{
DynareDataset
},
@var
{
DynareOptions
},
@var
{
Model
},
@var
{
EstimatedParameters
},
@var
{
BayesInfo
},
@var
{
DynareResults
},
@var
{
derivatives_flag
})
%!
@anchor
{
D
sge
L
ikelihood
}
%!
@anchor
{
d
sge
_l
ikelihood
}
%!
@sp
1
%!
@sp
1
%!
Evaluates
the
posterior
kernel
of
a
dsge
model
.
%!
Evaluates
the
posterior
kernel
of
a
dsge
model
.
%!
@sp
2
%!
@sp
2
...
@@ -428,13 +428,13 @@ switch DynareOptions.lik_init
...
@@ -428,13 +428,13 @@ switch DynareOptions.lik_init
[
err
,
Pstar
]
=
kalman_steady_state
(
transpose
(
T
),
R
*
Q
*
transpose
(
R
),
transpose
(
build_selection_matrix
(
Z
,
np
,
length
(
Z
))),
H
);
[
err
,
Pstar
]
=
kalman_steady_state
(
transpose
(
T
),
R
*
Q
*
transpose
(
R
),
transpose
(
build_selection_matrix
(
Z
,
np
,
length
(
Z
))),
H
);
end
end
if
err
if
err
disp
([
'
D
sge
L
ikelihood
:
:
I
am
not
able
to
solve
the
Riccati
equation
,
so
I
switch
to
lik_init
=
1
!
'
]);
disp
([
'
d
sge
_l
ikelihood
:
:
I
am
not
able
to
solve
the
Riccati
equation
,
so
I
switch
to
lik_init
=
1
!
'
]);
DynareOptions
.
lik_init
=
1
;
DynareOptions
.
lik_init
=
1
;
Pstar
=
lyapunov_symm
(
T
,
R
*
Q
*
R
'
,
DynareOptions
.
qz_criterium
,
DynareOptions
.
lyapunov_complex_threshold
);
Pstar
=
lyapunov_symm
(
T
,
R
*
Q
*
R
'
,
DynareOptions
.
qz_criterium
,
DynareOptions
.
lyapunov_complex_threshold
);
end
end
Pinf
=
[];
Pinf
=
[];
otherwise
otherwise
error
(
'
D
sge
L
ikelihood
::
Unknown
initialization
approach
for
the
Kalman
filter
!
'
)
error
(
'
d
sge
_l
ikelihood
::
Unknown
initialization
approach
for
the
Kalman
filter
!
'
)
end
end
if
analytic_derivation
if
analytic_derivation
...
...
matlab/dynare_estimation_1.m
View file @
ecac8714
...
@@ -32,7 +32,7 @@ function dynare_estimation_1(var_list_,dname)
...
@@ -32,7 +32,7 @@ function dynare_estimation_1(var_list_,dname)
global
M_
options_
oo_
estim_params_
bayestopt_
dataset_
global
M_
options_
oo_
estim_params_
bayestopt_
dataset_
if
~
options_
.
dsge_var
if
~
options_
.
dsge_var
objective_function
=
str2func
(
'
D
sge
L
ikelihood'
);
objective_function
=
str2func
(
'
d
sge
_l
ikelihood'
);
else
else
objective_function
=
str2func
(
'DsgeVarLikelihood'
);
objective_function
=
str2func
(
'DsgeVarLikelihood'
);
end
end
...
@@ -248,7 +248,7 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation
...
@@ -248,7 +248,7 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation
fval
=
feval
(
objective_function
,
xparam1
,
dataset_
,
options_
,
M_
,
estim_params_
,
bayestopt_
,
oo_
);
fval
=
feval
(
objective_function
,
xparam1
,
dataset_
,
options_
,
M_
,
estim_params_
,
bayestopt_
,
oo_
);
options_
.
mh_jscale
=
Scale
;
options_
.
mh_jscale
=
Scale
;
mouvement
=
max
(
max
(
abs
(
PostVar
-
OldPostVar
)));
mouvement
=
max
(
max
(
abs
(
PostVar
-
OldPostVar
)));
fval
=
D
sge
L
ikelihood
(
xparam1
,
dataset_
,
options_
,
M_
,
estim_params_
,
bayestopt_
,
oo_
);
fval
=
d
sge
_l
ikelihood
(
xparam1
,
dataset_
,
options_
,
M_
,
estim_params_
,
bayestopt_
,
oo_
);
disp
([
'Change in the covariance matrix = '
num2str
(
mouvement
)
'.'
])
disp
([
'Change in the covariance matrix = '
num2str
(
mouvement
)
'.'
])
disp
([
'Mode improvement = '
num2str
(
abs
(
OldMode
-
fval
))])
disp
([
'Mode improvement = '
num2str
(
abs
(
OldMode
-
fval
))])
OldMode
=
fval
;
OldMode
=
fval
;
...
...
matlab/dynare_resolve.m
View file @
ecac8714
...
@@ -41,7 +41,7 @@ function [A,B,ys,info,Model,DynareOptions,DynareResults] = dynare_resolve(Model,
...
@@ -41,7 +41,7 @@ function [A,B,ys,info,Model,DynareOptions,DynareResults] = dynare_resolve(Model,
%!
@sp
2
%!
@sp
2
%!
@strong
{
This
function
is
called
by
:
}
%!
@strong
{
This
function
is
called
by
:
}
%!
@sp
1
%!
@sp
1
%!
@ref
{
D
sge
L
ikelihood
},
@ref
{
DsgeLikelihood_hh
},
@ref
{
DsgeVarLikelihood
},
@ref
{
dsge_posterior_kernel
},
@ref
{
DsgeSmoother
},
@ref
{
dynare_sensitivity
},
@ref
{
gsa
/
thet2tau
},
@ref
{
gsa
/
stab_map
},
@ref
{
identification_analysis
},
@ref
{
imcforecast
},
@ref
{
thet2tau
}
%!
@ref
{
d
sge
_l
ikelihood
},
@ref
{
DsgeLikelihood_hh
},
@ref
{
DsgeVarLikelihood
},
@ref
{
dsge_posterior_kernel
},
@ref
{
DsgeSmoother
},
@ref
{
dynare_sensitivity
},
@ref
{
gsa
/
thet2tau
},
@ref
{
gsa
/
stab_map
},
@ref
{
identification_analysis
},
@ref
{
imcforecast
},
@ref
{
thet2tau
}
%!
@sp
2
%!
@sp
2
%!
@strong
{
This
function
calls
:
}
%!
@strong
{
This
function
calls
:
}
%!
@sp
1
%!
@sp
1
...
...
matlab/evaluate_likelihood.m
View file @
ecac8714
...
@@ -85,6 +85,6 @@ end
...
@@ -85,6 +85,6 @@ end
pshape_original
=
bayestopt_
.
pshape
;
pshape_original
=
bayestopt_
.
pshape
;
bayestopt_
.
pshape
=
Inf
(
size
(
bayestopt_
.
pshape
));
bayestopt_
.
pshape
=
Inf
(
size
(
bayestopt_
.
pshape
));
llik
=
-
D
sge
L
ikelihood
(
parameters
,
dataset
,
options_
,
M_
,
estim_params_
,
bayestopt_
,
oo_
);
llik
=
-
d
sge
_l
ikelihood
(
parameters
,
dataset
,
options_
,
M_
,
estim_params_
,
bayestopt_
,
oo_
);
bayestopt_
.
pshape
=
pshape_original
;
bayestopt_
.
pshape
=
pshape_original
;
\ No newline at end of file
matlab/identification_analysis.m
View file @
ecac8714
...
@@ -135,7 +135,7 @@ if info(1)==0,
...
@@ -135,7 +135,7 @@ if info(1)==0,
data_info
.
data
=
oo_
.
endo_simul
(
options_
.
varobs_id
,
100
+
1
:
end
);
data_info
.
data
=
oo_
.
endo_simul
(
options_
.
varobs_id
,
100
+
1
:
end
);
% datax=data;
% datax=data;
derivatives_info
.
no_DLIK
=
1
;
derivatives_info
.
no_DLIK
=
1
;
[
fval
,
cost_flag
,
ys
,
trend_coeff
,
info
,
M_
,
options_
,
bayestopt_
,
oo_
,
DLIK
,
AHess
]
=
D
sge
L
ikelihood
(
params
'
,
data_info
,
options_
,
M_
,
estim_params_
,
bayestopt_
,
oo_
,
derivatives_info
);
[
fval
,
cost_flag
,
ys
,
trend_coeff
,
info
,
M_
,
options_
,
bayestopt_
,
oo_
,
DLIK
,
AHess
]
=
d
sge
_l
ikelihood
(
params
'
,
data_info
,
options_
,
M_
,
estim_params_
,
bayestopt_
,
oo_
,
derivatives_info
);
% fval = DsgeLikelihood(xparam1,data_info,options_,M_,estim_params_,bayestopt_,oo_);
% fval = DsgeLikelihood(xparam1,data_info,options_,M_,estim_params_,bayestopt_,oo_);
AHess
=-
AHess
;
AHess
=-
AHess
;
ide_hess
.
AHess
=
AHess
;
ide_hess
.
AHess
=
AHess
;
...
...
matlab/initial_estimation_checks.m
View file @
ecac8714
...
@@ -41,7 +41,7 @@ end
...
@@ -41,7 +41,7 @@ end
if
DynareOptions
.
dsge_var
if
DynareOptions
.
dsge_var
[
fval
,
cost_flag
,
info
]
=
DsgeVarLikelihood
(
xparam1
,
DynareDataset
,
DynareOptions
,
Model
,
EstimatedParameters
,
BayesInfo
,
DynareResults
);
[
fval
,
cost_flag
,
info
]
=
DsgeVarLikelihood
(
xparam1
,
DynareDataset
,
DynareOptions
,
Model
,
EstimatedParameters
,
BayesInfo
,
DynareResults
);
else
else
[
fval
,
cost_flag
,
ys
,
trend_coeff
,
info
]
=
D
sge
L
ikelihood
(
xparam1
,
DynareDataset
,
DynareOptions
,
Model
,
EstimatedParameters
,
BayesInfo
,
DynareResults
);
[
fval
,
cost_flag
,
ys
,
trend_coeff
,
info
]
=
d
sge
_l
ikelihood
(
xparam1
,
DynareDataset
,
DynareOptions
,
Model
,
EstimatedParameters
,
BayesInfo
,
DynareResults
);
end
end
if
info
(
1
)
>
0
if
info
(
1
)
>
0
...
...
matlab/kalman/likelihood/kalman_filter.m
View file @
ecac8714
...
@@ -2,7 +2,7 @@ function [LIK, likk, a, P] = kalman_filter(Y,start,last,a,P,kalman_tol,riccati_t
...
@@ -2,7 +2,7 @@ function [LIK, likk, a, P] = kalman_filter(Y,start,last,a,P,kalman_tol,riccati_t
%
Computes
the
likelihood
of
a
stationnary
state
space
model
.
%
Computes
the
likelihood
of
a
stationnary
state
space
model
.
%
@info
:
%
@info
:
%!
@deftypefn
{
Function
File
}
{[
@var
{
LIK
},
@var
{
likk
},
@var
{
a
},
@var
{
P
}
]
=
}
DsgeLikelihood
(
@var
{
Y
},
@var
{
start
},
@var
{
last
},
@var
{
a
},
@var
{
P
},
@var
{
kalman_tol
},
@var
{
riccati_tol
},
@var
{
presample
},
@var
{
T
},
@var
{
Q
},
@var
{
R
},
@var
{
H
},
@var
{
Z
},
@var
{
mm
},
@var
{
pp
},
@var
{
rr
},
@var
{
Zflag
},
@var
{
diffuse_periods
})
%!
@deftypefn
{
Function
File
}
{[
@var
{
LIK
},
@var
{
likk
},
@var
{
a
},
@var
{
P
}
]
=
}
kalman_filter
(
@var
{
Y
},
@var
{
start
},
@var
{
last
},
@var
{
a
},
@var
{
P
},
@var
{
kalman_tol
},
@var
{
riccati_tol
},
@var
{
presample
},
@var
{
T
},
@var
{
Q
},
@var
{
R
},
@var
{
H
},
@var
{
Z
},
@var
{
mm
},
@var
{
pp
},
@var
{
rr
},
@var
{
Zflag
},
@var
{
diffuse_periods
})
%!
@anchor
{
kalman_filter
}
%!
@anchor
{
kalman_filter
}
%!
@sp
1
%!
@sp
1
%!
Computes
the
likelihood
of
a
stationary
state
space
model
,
given
initial
condition
for
the
states
(
mean
and
variance
).
%!
Computes
the
likelihood
of
a
stationary
state
space
model
,
given
initial
condition
for
the
states
(
mean
and
variance
).
...
@@ -63,7 +63,7 @@ function [LIK, likk, a, P] = kalman_filter(Y,start,last,a,P,kalman_tol,riccati_t
...
@@ -63,7 +63,7 @@ function [LIK, likk, a, P] = kalman_filter(Y,start,last,a,P,kalman_tol,riccati_t
%!
@sp
2
%!
@sp
2
%!
@strong
{
This
function
is
called
by
:
}
%!
@strong
{
This
function
is
called
by
:
}
%!
@sp
1
%!
@sp
1
%!
@ref
{
D
sge
L
ikelihood
}
%!
@ref
{
d
sge
_l
ikelihood
}
%!
@sp
2
%!
@sp
2
%!
@strong
{
This
function
calls
:
}
%!
@strong
{
This
function
calls
:
}
%!
@sp
1
%!
@sp
1
...
...
matlab/kalman/likelihood/kalman_filter_ss.m
View file @
ecac8714
...
@@ -2,7 +2,7 @@ function [LIK, likk, a] = kalman_filter_ss(Y,start,last,a,T,K,iF,dF,Z,pp,Zflag)
...
@@ -2,7 +2,7 @@ function [LIK, likk, a] = kalman_filter_ss(Y,start,last,a,T,K,iF,dF,Z,pp,Zflag)
%
Computes
the
likelihood
of
a
stationnary
state
space
model
(
steady
state
kalman
filter
).
%
Computes
the
likelihood
of
a
stationnary
state
space
model
(
steady
state
kalman
filter
).
%
@info
:
%
@info
:
%!
@deftypefn
{
Function
File
}
{[
@var
{
LIK
},
@var
{
likk
},
@var
{
a
},
@var
{
P
}
]
=
}
DsgeLikelihood
(
@var
{
Y
},
@var
{
start
},
@var
{
last
},
@var
{
a
},
@var
{
P
},
@var
{
kalman_tol
},
@var
{
riccati_tol
},
@var
{
presample
},
@var
{
T
},
@var
{
Q
},
@var
{
R
},
@var
{
H
},
@var
{
Z
},
@var
{
mm
},
@var
{
pp
},
@var
{
rr
},
@var
{
Zflag
},
@var
{
diffuse_periods
})
%!
@deftypefn
{
Function
File
}
{[
@var
{
LIK
},
@var
{
likk
},
@var
{
a
},
@var
{
P
}
]
=
}
kalman_filter_ss
(
@var
{
Y
},
@var
{
start
},
@var
{
last
},
@var
{
a
},
@var
{
P
},
@var
{
kalman_tol
},
@var
{
riccati_tol
},
@var
{
presample
},
@var
{
T
},
@var
{
Q
},
@var
{
R
},
@var
{
H
},
@var
{
Z
},
@var
{
mm
},
@var
{
pp
},
@var
{
rr
},
@var
{
Zflag
},
@var
{
diffuse_periods
})
%!
@anchor
{
kalman_filter
}
%!
@anchor
{
kalman_filter
}
%!
@sp
1
%!
@sp
1
%!
Computes
the
likelihood
of
a
stationary
state
space
model
,
given
initial
condition
for
the
states
(
mean
),
the
steady
state
kalman
gain
and
the
steady
state
inveverted
covariance
matrix
of
the
prediction
errors
.
%!
Computes
the
likelihood
of
a
stationary
state
space
model
,
given
initial
condition
for
the
states
(
mean
),
the
steady
state
kalman
gain
and
the
steady
state
inveverted
covariance
matrix
of
the
prediction
errors
.
...
...
matlab/kalman/likelihood/univariate_kalman_filter.m
View file @
ecac8714
...
@@ -69,7 +69,7 @@ function [LIK, likk,a,P] = univariate_kalman_filter(data_index,number_of_observa
...
@@ -69,7 +69,7 @@ function [LIK, likk,a,P] = univariate_kalman_filter(data_index,number_of_observa
%!
@sp
2
%!
@sp
2
%!
@strong
{
This
function
is
called
by
:
}
%!
@strong
{
This
function
is
called
by
:
}
%!
@sp
1
%!
@sp
1
%!
@ref
{
D
sge
L
ikelihood
}
%!
@ref
{
d
sge
_l
ikelihood
}
%!
@sp
2
%!
@sp
2
%!
@strong
{
This
function
calls
:
}
%!
@strong
{
This
function
calls
:
}
%!
@sp
1
%!
@sp
1
...
...
matlab/kalman/likelihood/univariate_kalman_filter_d.m
View file @
ecac8714
...
@@ -73,7 +73,7 @@ function [dLIK, dlikk, a, Pstar, llik] = univariate_kalman_filter_d(data_index,
...
@@ -73,7 +73,7 @@ function [dLIK, dlikk, a, Pstar, llik] = univariate_kalman_filter_d(data_index,
%!
@sp
2
%!
@sp
2
%!
@strong
{
This
function
is
called
by
:
}
%!
@strong
{
This
function
is
called
by
:
}
%!
@sp
1
%!
@sp
1
%!
@ref
{
D
sge
L
ikelihood
},
@ref
{
DsgeLikelihood_hh
}
%!
@ref
{
d
sge
_l
ikelihood
},
@ref
{
DsgeLikelihood_hh
}
%!
@sp
2
%!
@sp
2
%!
@strong
{
This
function
calls
:
}
%!
@strong
{
This
function
calls
:
}
%!
@sp
1
%!
@sp
1
...
...
matlab/print_info.m
View file @
ecac8714
...
@@ -73,7 +73,7 @@ if ~noprint
...
@@ -73,7 +73,7 @@ if ~noprint
error
(
'one (many) parameter(s) do(es) not satisfy the upper bound'
);
error
(
'one (many) parameter(s) do(es) not satisfy the upper bound'
);
case
43
case
43
error
(
'Covariance matrix of shocks is not positive definite'
)
error
(
'Covariance matrix of shocks is not positive definite'
)
case
44
%DsgeLikelihood_hh /
D
sge
L
ikelihood
case
44
%DsgeLikelihood_hh /
d
sge
_l
ikelihood
error
(
''
);
error
(
''
);
case
51
case
51
error
(
'You are estimating a DSGE-VAR model, but the value of the dsge prior weight is too low!'
)
error
(
'You are estimating a DSGE-VAR model, but the value of the dsge prior weight is too low!'
)
...
...
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