Commit e1274832 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Fixed bug reported by Johannes...

Fixed bug reported by Johannes (http://www.dynare.org/pipermail/dev/2012-May/002015.html), see also trac#257.
parent fac95280
......@@ -58,12 +58,17 @@ end
[dataset_,xparam1, M_, options_, oo_, estim_params_,bayestopt_] = dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_, bayestopt_);
% Set sigma_e_is_diagonal flag (needed if the shocks block is not declared in the mod file)
% Set sigma_e_is_diagonal flag (needed if the shocks block is not declared in the mod file).
M_.sigma_e_is_diagonal = 1;
if estim_params_.ncx
if estim_params_.ncx || ~isequal(nnz(M_.Sigma_e),length(M_.Sigma_e))
M_.sigma_e_is_diagonal = 0;
end
% Set the correlation matrix if necessary.
if ~isequal(estim_params_.ncx,nnz(tril(M_.Sigma_e,-1)))
M_.Correlation_matrix = diag(1./sqrt(diag(M_.Sigma_e)))*M_.Sigma_e*diag(1./sqrt(diag(M_.Sigma_e)));
end
data = dataset_.data;
rawdata = dataset_.rawdata;
data_index = dataset_.missing.aindex;
......
......@@ -392,6 +392,7 @@ oo_.exo_det_simul = [];
M_.params = [];
M_.endo_histval = [];
M_.Correlation_matrix = [];
% homotopy
options_.homotopy_mode = 0;
......
......@@ -63,11 +63,16 @@ end
offset = nvx+nvn;
% setting shocks covariances
if ~isempty(M_.Correlation_matrix)
Sigma_e = diag(sqrt(diag(Sigma_e)))*M_.Correlation_matrix*diag(sqrt(diag(Sigma_e)));
end
if ncx
corrx = estim_params_.corrx;
for i=1:ncx
k1 = corrx(i,1);
k2 = corrx(i,2);
M_.Correlation_matrix(k1,k2) = xparam1(i+offset);
M_.Correlation_matrix(k2,k1) = M_.Correlation_matrix(k1,k2);
Sigma_e(k1,k2) = xparam1(i+offset)*sqrt(Sigma_e(k1,k1)*Sigma_e(k2,k2));
Sigma_e(k2,k1) = Sigma_e(k1,k2);
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment