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
cc045caa
Verified
Commit
cc045caa
authored
4 years ago
by
Johannes Pfeifer
Committed by
Sébastien Villemot
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
loglinear: Take care of non-logged lagged/leaded exogenous variables
Closes:
#1783
parent
5a2fbe2f
No related branches found
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
matlab/dynare.m
+3
-3
3 additions, 3 deletions
matlab/dynare.m
matlab/simult_.m
+2
-1
2 additions, 1 deletion
matlab/simult_.m
matlab/store_smoother_results.m
+14
-1
14 additions, 1 deletion
matlab/store_smoother_results.m
with
19 additions
and
5 deletions
matlab/dynare.m
+
3
−
3
View file @
cc045caa
...
@@ -281,10 +281,10 @@ try
...
@@ -281,10 +281,10 @@ try
evalin
(
'base'
,[
fname
'.driver'
])
;
evalin
(
'base'
,[
fname
'.driver'
])
;
catch
ME
catch
ME
W
=
evalin
(
'base'
,
'whos'
);
W
=
evalin
(
'base'
,
'whos'
);
diary
off
diary
off
if
ismember
(
fname
,
[
W
(:)
.
name
]
)
if
ismember
(
fname
,
{
W
(:)
.
name
}
)
error
(
'Your base workspace already contains a variable with the same name as the mod-file. You need to delete it or rename the mod-file.'
)
error
(
'Your base workspace already contains a variable with the same name as the mod-file. You need to delete it or rename the mod-file.'
)
else
else
rethrow
(
ME
)
rethrow
(
ME
)
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
matlab/simult_.m
+
2
−
1
View file @
cc045caa
...
@@ -42,7 +42,8 @@ y_ = zeros(size(y0,1),iter+M_.maximum_lag);
...
@@ -42,7 +42,8 @@ y_ = zeros(size(y0,1),iter+M_.maximum_lag);
y_
(:,
1
)
=
y0
;
y_
(:,
1
)
=
y0
;
if
options_
.
loglinear
&&
~
options_
.
logged_steady_state
if
options_
.
loglinear
&&
~
options_
.
logged_steady_state
dr
.
ys
=
log
(
dr
.
ys
);
k
=
get_all_variables_but_lagged_leaded_exogenous
(
M_
);
dr
.
ys
(
k
)
=
log
(
dr
.
ys
(
k
));
end
end
if
~
options_
.
k_order_solver
||
(
options_
.
k_order_solver
&&
options_
.
pruning
)
%if k_order_pert is not used or if we do not use Dynare++ with k_order_pert
if
~
options_
.
k_order_solver
||
(
options_
.
k_order_solver
&&
options_
.
pruning
)
%if k_order_pert is not used or if we do not use Dynare++ with k_order_pert
...
...
This diff is collapsed.
Click to expand it.
matlab/store_smoother_results.m
+
14
−
1
View file @
cc045caa
...
@@ -79,6 +79,12 @@ end
...
@@ -79,6 +79,12 @@ end
if
options_
.
loglinear
if
options_
.
loglinear
oo_
.
Smoother
.
loglinear
=
true
;
oo_
.
Smoother
.
loglinear
=
true
;
if
~
isempty
(
M_
.
aux_vars
)
% deal with lead/lag of exogenous variables
exo_lead_lag_index
=
M_
.
orig_endo_nbr
+
find
(([
M_
.
aux_vars
.
type
]
==
2
)
|
([
M_
.
aux_vars
.
type
]
==
3
));
else
exo_lead_lag_index
=
[];
end
else
else
oo_
.
Smoother
.
loglinear
=
false
;
oo_
.
Smoother
.
loglinear
=
false
;
end
end
...
@@ -137,6 +143,9 @@ if ~isempty(options_.nk) && options_.nk ~= 0
...
@@ -137,6 +143,9 @@ if ~isempty(options_.nk) && options_.nk ~= 0
i_endo_declaration_order
=
oo_
.
dr
.
order_var
(
i_endo_in_dr_matrices
);
%get indices of smoothed variables in name vector
i_endo_declaration_order
=
oo_
.
dr
.
order_var
(
i_endo_in_dr_matrices
);
%get indices of smoothed variables in name vector
if
options_
.
loglinear
%logged steady state must be used
if
options_
.
loglinear
%logged steady state must be used
constant_all_variables
=
repmat
(
log
(
ys
(
i_endo_declaration_order
))
'
,[
length
(
options_
.
filter_step_ahead
),
1
,
gend
+
max
(
options_
.
filter_step_ahead
)]);
constant_all_variables
=
repmat
(
log
(
ys
(
i_endo_declaration_order
))
'
,[
length
(
options_
.
filter_step_ahead
),
1
,
gend
+
max
(
options_
.
filter_step_ahead
)]);
if
~
isempty
(
exo_lead_lag_index
)
&&
any
(
ismember
(
i_endo_declaration_order
,
exo_lead_lag_index
))
% deal with lead/lag of exogenous variables
constant_all_variables
(:,
ismember
(
i_endo_declaration_order
,
exo_lead_lag_index
),:)
=
repmat
(
ys
(
i_endo_declaration_order
(
ismember
(
i_endo_declaration_order
,
exo_lead_lag_index
)))
'
,[
length
(
options_
.
filter_step_ahead
),
1
,
gend
+
max
(
options_
.
filter_step_ahead
)]);
end
elseif
~
options_
.
loglinear
%unlogged steady state must be used
elseif
~
options_
.
loglinear
%unlogged steady state must be used
constant_all_variables
=
repmat
((
ys
(
i_endo_declaration_order
))
'
,[
length
(
options_
.
filter_step_ahead
),
1
,
gend
+
max
(
options_
.
filter_step_ahead
)]);
constant_all_variables
=
repmat
((
ys
(
i_endo_declaration_order
))
'
,[
length
(
options_
.
filter_step_ahead
),
1
,
gend
+
max
(
options_
.
filter_step_ahead
)]);
end
end
...
@@ -157,7 +166,11 @@ for i_endo_in_bayestopt_smoother_varlist=bayestopt_.smoother_saved_var_list'
...
@@ -157,7 +166,11 @@ for i_endo_in_bayestopt_smoother_varlist=bayestopt_.smoother_saved_var_list'
i_endo_declaration_order
=
oo_
.
dr
.
order_var
(
i_endo_in_dr
);
%get indices of smoothed variables in name vector
i_endo_declaration_order
=
oo_
.
dr
.
order_var
(
i_endo_in_dr
);
%get indices of smoothed variables in name vector
%% Compute constant
%% Compute constant
if
options_
.
loglinear
==
1
%logged steady state must be used
if
options_
.
loglinear
==
1
%logged steady state must be used
constant_current_variable
=
repmat
(
log
(
ys
(
i_endo_declaration_order
)),
gend
,
1
);
if
~
isempty
(
exo_lead_lag_index
)
&&
ismember
(
i_endo_declaration_order
,
exo_lead_lag_index
)
% deal with lead/lag of exogenous variables
constant_current_variable
=
repmat
(
ys
(
i_endo_declaration_order
),
gend
,
1
);
else
constant_current_variable
=
repmat
(
log
(
ys
(
i_endo_declaration_order
)),
gend
,
1
);
end
elseif
options_
.
loglinear
==
0
%unlogged steady state must be used
elseif
options_
.
loglinear
==
0
%unlogged steady state must be used
constant_current_variable
=
repmat
((
ys
(
i_endo_declaration_order
)),
gend
,
1
);
constant_current_variable
=
repmat
((
ys
(
i_endo_declaration_order
)),
gend
,
1
);
end
end
...
...
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