Some questions about coding involving Dynare variables
Posted: Wed Jun 06, 2012 1:32 pm
Hello all,
I got a problem about coding involving Dynare variables. The situation is,
After running the dynare model file, I got something like M_, oo_. Given those, I would like to changethe parameter by locating corresponding location of "M_.params" based on "M_.param_names", say I want to change the value of 'BETTA' and 'ALPA' defined in the model file, then what I can do is, including the following commands
par_list = strvcat('BETTA','ALPA');
par_value = [0.94 0.03];
par_list_ind = strmatch(par_list(i,:),M_.param_names,'exact');
M_.params(par_list_ind,:) = par_value(i,:)';
However, if the covariance matrix of shocks depends on parameter, eg,
shocks;
var epsah; stderr STD_EPSAH;
var epsaf; stderr STD_EPSAF;
var epsah, epsaf = COR_EPSAHAF*STD_EPSAH*STD_EPSAF;
end;
and after running dynare model file, we can get the below commands,
M_.Sigma_e(1, 1) = (M_.params(40))^2;
M_.Sigma_e(2, 2) = (M_.params(41))^2;
M_.Sigma_e(1, 2) = M_.params(41)*M_.params(40)*M_.params(42);
M_.Sigma_e(2, 1) = M_.Sigma_e(1, 2);
in abc.m if abc.mod is run by Dynare. In order to update the parameter of STD_EPSAH, STD_EPSAF, then, I need to include,
par_list = strvcat('STD_EPSAH','STD_EPSAF');
par_value = [0.01 0.01];
par_list_ind = strmatch(par_list(i,:),M_.param_names,'exact');
M_.params(par_list_ind,:) = par_value(i,:)';
On the other hands, Sigma_e should also be updated correspondingly but I want to ask is that, can I make the code to update Sigma_e flexibly by some commands instead of copying the commands in abc.m?
Furthermore, can I capture the commands
M_.Sigma_e(1, 1) = (M_.params(40))^2;
M_.Sigma_e(2, 2) = (M_.params(41))^2;
M_.Sigma_e(1, 2) = M_.params(41)*M_.params(40)*M_.params(42);
M_.Sigma_e(2, 1) = M_.Sigma_e(1, 2);
in abc.m fleixbly by including appropriate commands in .mod file?
Thanks for your kind attention.
I got a problem about coding involving Dynare variables. The situation is,
After running the dynare model file, I got something like M_, oo_. Given those, I would like to changethe parameter by locating corresponding location of "M_.params" based on "M_.param_names", say I want to change the value of 'BETTA' and 'ALPA' defined in the model file, then what I can do is, including the following commands
par_list = strvcat('BETTA','ALPA');
par_value = [0.94 0.03];
par_list_ind = strmatch(par_list(i,:),M_.param_names,'exact');
M_.params(par_list_ind,:) = par_value(i,:)';
However, if the covariance matrix of shocks depends on parameter, eg,
shocks;
var epsah; stderr STD_EPSAH;
var epsaf; stderr STD_EPSAF;
var epsah, epsaf = COR_EPSAHAF*STD_EPSAH*STD_EPSAF;
end;
and after running dynare model file, we can get the below commands,
M_.Sigma_e(1, 1) = (M_.params(40))^2;
M_.Sigma_e(2, 2) = (M_.params(41))^2;
M_.Sigma_e(1, 2) = M_.params(41)*M_.params(40)*M_.params(42);
M_.Sigma_e(2, 1) = M_.Sigma_e(1, 2);
in abc.m if abc.mod is run by Dynare. In order to update the parameter of STD_EPSAH, STD_EPSAF, then, I need to include,
par_list = strvcat('STD_EPSAH','STD_EPSAF');
par_value = [0.01 0.01];
par_list_ind = strmatch(par_list(i,:),M_.param_names,'exact');
M_.params(par_list_ind,:) = par_value(i,:)';
On the other hands, Sigma_e should also be updated correspondingly but I want to ask is that, can I make the code to update Sigma_e flexibly by some commands instead of copying the commands in abc.m?
Furthermore, can I capture the commands
M_.Sigma_e(1, 1) = (M_.params(40))^2;
M_.Sigma_e(2, 2) = (M_.params(41))^2;
M_.Sigma_e(1, 2) = M_.params(41)*M_.params(40)*M_.params(42);
M_.Sigma_e(2, 1) = M_.Sigma_e(1, 2);
in abc.m fleixbly by including appropriate commands in .mod file?
Thanks for your kind attention.