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
edf9955c
Commit
edf9955c
authored
Nov 16, 2012
by
Frédéric Karamé
Browse files
fix bug when comparing xparam with upper and lower bounds.
parent
b6c72f18
Changes
1
Hide whitespace changes
Inline
Side-by-side
matlab/non_linear_dsge_likelihood.m
View file @
edf9955c
...
...
@@ -142,7 +142,7 @@ nvobs = DynareDataset.info.nvobs;
%
Return
,
with
endogenous
penalty
,
if
some
parameters
are
smaller
than
the
lower
bound
of
the
prior
domain
.
if
(
DynareOptions
.
mode_compute
~=
1
)
&&
any
(
xparam1
<
BayesInfo
.
lb
)
k
=
find
(
xparam1
<
BayesInfo
.
lb
);
k
=
find
(
xparam1
(
:
)
<
BayesInfo
.
lb
);
fval
=
objective_function_penalty_base
+
sum
((
BayesInfo
.
lb
(
k
)
-
xparam1
(
k
)).
^
2
);
exit_flag
=
0
;
info
=
41
;
...
...
@@ -151,7 +151,7 @@ end
%
Return
,
with
endogenous
penalty
,
if
some
parameters
are
greater
than
the
upper
bound
of
the
prior
domain
.
if
(
DynareOptions
.
mode_compute
~=
1
)
&&
any
(
xparam1
>
BayesInfo
.
ub
)
k
=
find
(
xparam1
>
BayesInfo
.
ub
);
k
=
find
(
xparam1
(
:
)
>
BayesInfo
.
ub
);
fval
=
objective_function_penalty_base
+
sum
((
xparam1
(
k
)
-
BayesInfo
.
ub
(
k
)).
^
2
);
exit_flag
=
0
;
info
=
42
;
...
...
@@ -345,7 +345,11 @@ ReducedForm.StateVectorVariance = StateVectorVariance;
%
4
.
Likelihood
evaluation
%------------------------------------------------------------------------------
DynareOptions
.
warning_for_steadystate
=
0
;
seed_norm_old
=
randn
(
'
state
'
)
;
seed_uniform_old
=
rand
(
'
state
'
)
;
LIK
=
feval
(
DynareOptions
.
particle
.
algorithm
,
ReducedForm
,
Y
,[],
DynareOptions
);
randn
(
'
state
'
,
seed_norm_old
);
rand
(
'
state
'
,
seed_uniform_old
);
if
imag
(
LIK
)
likelihood
=
objective_function_penalty_base
;
exit_flag
=
0
;
...
...
@@ -359,5 +363,5 @@ DynareOptions.warning_for_steadystate = 1;
%
------------------------------------------------------------------------------
%
Adds
prior
if
necessary
%
------------------------------------------------------------------------------
lnprior
=
priordens
(
xparam1
,
BayesInfo
.
pshape
,
BayesInfo
.
p6
,
BayesInfo
.
p7
,
BayesInfo
.
p3
,
BayesInfo
.
p4
);
lnprior
=
priordens
(
xparam1
(:)
,
BayesInfo
.
pshape
,
BayesInfo
.
p6
,
BayesInfo
.
p7
,
BayesInfo
.
p3
,
BayesInfo
.
p4
);
fval
=
(
likelihood
-
lnprior
);
\ No newline at end of file
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