update var_expectation code and tests for change in field name

time-shift
Houtan Bastani 2018-08-23 10:35:52 +02:00
parent 50fbc8026c
commit 6ec9758313
6 changed files with 12 additions and 12 deletions

View File

@ -44,21 +44,21 @@ end
varexpectationmodel = DynareModel.var_expectation.(varexpectationmodelname); varexpectationmodel = DynareModel.var_expectation.(varexpectationmodelname);
% Get the name of the associated VAR model and test its existence. % Get the name of the associated VAR model and test its existence.
if ~isfield(DynareModel.var, varexpectationmodel.var_model_name) if ~isfield(DynareModel.var, varexpectationmodel.auxiliary_model_name)
error('Unknown VAR (%s) in VAR_EXPECTATION_MODEL (%s)!', varexpectationmodel.var_model_name, varexpectationmodelname) error('Unknown VAR (%s) in VAR_EXPECTATION_MODEL (%s)!', varexpectationmodel.auxiliary_model_name, varexpectationmodelname)
end end
varmodel = DynareModel.var.(varexpectationmodel.var_model_name); varmodel = DynareModel.var.(varexpectationmodel.auxiliary_model_name);
% Check that we have the values of the VAR matrices. % Check that we have the values of the VAR matrices.
if ~isfield(DynareOutput.var, varexpectationmodel.var_model_name) if ~isfield(DynareOutput.var, varexpectationmodel.auxiliary_model_name)
error('VAR model %s has to be estimated or calibrated first!', varexpectationmodel.var_model_name) error('VAR model %s has to be estimated or calibrated first!', varexpectationmodel.auxiliary_model_name)
end end
varcalib = DynareOutput.var.(varexpectationmodel.var_model_name); varcalib = DynareOutput.var.(varexpectationmodel.auxiliary_model_name);
if ~isfield(varcalib, 'CompanionMatrix') || any(isnan(varcalib.CompanionMatrix(:))) if ~isfield(varcalib, 'CompanionMatrix') || any(isnan(varcalib.CompanionMatrix(:)))
message = sprintf('VAR model %s has to be estimated first.', varexpectationmodel.var_model_name); message = sprintf('VAR model %s has to be estimated first.', varexpectationmodel.auxiliary_model_name);
message = sprintf('s\nPlease use get_companion_matrix command first.', message); message = sprintf('s\nPlease use get_companion_matrix command first.', message);
error(message) error(message)
end end

View File

@ -36,7 +36,7 @@ var_model(model_name = toto, eqtags = [ 'X' 'Y' 'Z' ]);
** where the sum is over h=0,, and the conditional expectations are computed with VAR model `var_model_name`. ** where the sum is over h=0,, and the conditional expectations are computed with VAR model `var_model_name`.
*/ */
var_expectation_model(model_name = varexp, variable = x, var_model_name = toto, horizon = 1, discount = beta) ; var_expectation_model(model_name = varexp, variable = x, auxiliary_model_name = toto, horizon = 1, discount = beta) ;
model; model;

View File

@ -36,7 +36,7 @@ var_model(model_name = toto, eqtags = [ 'X' 'Y' 'Z' ]);
** where the sum is over h=0,, and the conditional expectations are computed with VAR model `var_model_name`. ** where the sum is over h=0,, and the conditional expectations are computed with VAR model `var_model_name`.
*/ */
var_expectation_model(model_name = varexp, variable = x, var_model_name = toto, horizon = 2, discount = beta) ; var_expectation_model(model_name = varexp, variable = x, auxiliary_model_name = toto, horizon = 2, discount = beta) ;
model; model;

View File

@ -36,7 +36,7 @@ var_model(model_name = toto, eqtags = [ 'X' 'Y' 'Z' ]);
** where the sum is over h=0,, and the conditional expectations are computed with VAR model `var_model_name`. ** where the sum is over h=0,, and the conditional expectations are computed with VAR model `var_model_name`.
*/ */
var_expectation_model(model_name = varexp, variable = x, var_model_name = toto, horizon = 0:Inf, discount = beta) ; var_expectation_model(model_name = varexp, variable = x, auxiliary_model_name = toto, horizon = 0:Inf, discount = beta) ;
model; model;

View File

@ -36,7 +36,7 @@ var_model(model_name = toto, eqtags = [ 'X' 'Y' 'Z' ]);
** where the sum is over h=0,, and the conditional expectations are computed with VAR model `var_model_name`. ** where the sum is over h=0,, and the conditional expectations are computed with VAR model `var_model_name`.
*/ */
var_expectation_model(model_name = varexp, variable = x, var_model_name = toto, horizon = 0:500, discount = beta) ; var_expectation_model(model_name = varexp, variable = x, auxiliary_model_name = toto, horizon = 0:500, discount = beta) ;
model; model;

View File

@ -36,7 +36,7 @@ var_model(model_name = toto, eqtags = [ 'X' 'Y' 'Z' ]);
** where the sum is over h=0,, and the conditional expectations are computed with VAR model `var_model_name`. ** where the sum is over h=0,, and the conditional expectations are computed with VAR model `var_model_name`.
*/ */
var_expectation_model(model_name = varexp, variable = x, var_model_name = toto, horizon = 15:50, discount = beta) ; var_expectation_model(model_name = varexp, variable = x, auxiliary_model_name = toto, horizon = 15:50, discount = beta) ;
model; model;