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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dóra Kocsis
dynare
Commits
6b3bd9dd
Commit
6b3bd9dd
authored
12 years ago
by
MichelJuillard
Browse files
Options
Downloads
Patches
Plain Diff
penalty is now passed as a field of bayestopt_ (or BayesInfo)
parent
169ab6c2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
matlab/DsgeVarLikelihood.m
+3
-11
3 additions, 11 deletions
matlab/DsgeVarLikelihood.m
matlab/dsge_likelihood.m
+1
-19
1 addition, 19 deletions
matlab/dsge_likelihood.m
with
4 additions
and
30 deletions
matlab/DsgeVarLikelihood.m
+
3
−
11
View file @
6b3bd9dd
...
@@ -35,7 +35,9 @@ function [fval,grad,hess,exit_flag,info,PHI,SIGMAu,iXX,prior] = DsgeVarLikelihoo
...
@@ -35,7 +35,9 @@ function [fval,grad,hess,exit_flag,info,PHI,SIGMAu,iXX,prior] = DsgeVarLikelihoo
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% Declaration of the persistent variables.
% Declaration of the persistent variables.
persistent
penalty
dsge_prior_weight_idx
persistent
dsge_prior_weight_idx
penalty
=
BayesInfo
.
penalty
;
grad
=
[];
grad
=
[];
hess
=
[];
hess
=
[];
...
@@ -46,16 +48,6 @@ SIGMAu = [];
...
@@ -46,16 +48,6 @@ SIGMAu = [];
iXX
=
[];
iXX
=
[];
prior
=
[];
prior
=
[];
% Initialization of the penalty
if
~
nargin
||
isempty
(
penalty
)
penalty
=
1e8
;
if
~
nargin
,
return
,
end
end
if
nargin
==
1
penalty
=
xparam1
;
return
end
% Initialization of of the index for parameter dsge_prior_weight in Model.params.
% Initialization of of the index for parameter dsge_prior_weight in Model.params.
if
isempty
(
dsge_prior_weight_idx
)
if
isempty
(
dsge_prior_weight_idx
)
dsge_prior_weight_idx
=
strmatch
(
'dsge_prior_weight'
,
Model
.
param_names
);
dsge_prior_weight_idx
=
strmatch
(
'dsge_prior_weight'
,
Model
.
param_names
);
...
...
This diff is collapsed.
Click to expand it.
matlab/dsge_likelihood.m
+
1
−
19
View file @
6b3bd9dd
...
@@ -130,22 +130,7 @@ function [fval,DLIK,Hess,exit_flag,ys,trend_coeff,info,Model,DynareOptions,Bayes
...
@@ -130,22 +130,7 @@ function [fval,DLIK,Hess,exit_flag,ys,trend_coeff,info,Model,DynareOptions,Bayes
%
AUTHOR
(
S
)
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
FR
%
AUTHOR
(
S
)
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
FR
%
Declaration
of
the
penalty
as
a
persistent
variable
.
penalty
=
BayesInfo
.
penalty
;
%
Persistent
variable
'
penalty
'
is
used
to
compute
an
endogenous
penalty
to
%
the
value
'
fval
'
when
various
conditions
are
encountered
.
These
conditions
%
set
also
'
exit_flag
'
equal
to
0
instead
of
1
.
It
is
only
when
%
dsge_likelihood
()
is
called
by
an
optimizer
called
by
%
dynare_estimation_1
()
that
'
exit_flag
'
is
ignored
and
penalized
'
fval
'
is
%
actually
used
.
%
In
that
case
,
'
penalty
'
is
properly
initialized
,
at
the
very
end
of
the
%
present
function
,
by
a
call
to
dsge_likelihood
()
made
in
%
initial_estimation_checks
().
If
a
condition
triggers
exit_flag
==
%
0
,
initial_estimation_checks
()
triggers
an
error
.
%
In
summary
,
an
initial
call
to
the
present
function
,
without
triggering
%
any
condition
,
guarantees
that
'
penalty
'
is
properly
initialized
when
needed
.
persistent
penalty
%
Initialization
of
the
returned
variables
and
others
...
%
Initialization
of
the
returned
variables
and
others
...
fval
=
[];
fval
=
[];
...
@@ -771,9 +756,6 @@ end
...
@@ -771,9 +756,6 @@ end
%
Update
DynareOptions
.
kalman_algo
.
%
Update
DynareOptions
.
kalman_algo
.
DynareOptions
.
kalman_algo
=
kalman_algo
;
DynareOptions
.
kalman_algo
=
kalman_algo
;
%
Update
the
penalty
.
penalty
=
fval
;
if
analytic_derivation
==
0
&&
nargout
==
2
,
if
analytic_derivation
==
0
&&
nargout
==
2
,
lik
=
lik
(
start
:
end
,
:
);
lik
=
lik
(
start
:
end
,
:
);
DLIK
=
[
-
lnprior
;
lik
(
:
)];
DLIK
=
[
-
lnprior
;
lik
(
:
)];
...
...
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