Removed lgyidx2varobs field (vector of integers) in options_. Added checks about the declared observed variables.
parent
c824217163
commit
7756bc3af2
|
@ -49,16 +49,35 @@ else
|
||||||
options_.varlist = var_list_;
|
options_.varlist = var_list_;
|
||||||
end
|
end
|
||||||
|
|
||||||
% Get the indices of the observed variables in M_.endo_names.
|
% Set the number of observed variables.
|
||||||
options_.lgyidx2varobs = zeros(size(M_.endo_names,1),1);
|
options_.number_of_observed_variables = length(options_.varobs);
|
||||||
for i = 1:size(M_.endo_names,1)
|
|
||||||
|
% Check that each declared observed variable is also an endogenous variable.
|
||||||
|
for i = 1:options_.number_of_observed_variables
|
||||||
|
id = strmatch(options_.varobs{i}, M_.endo_names, 'exact');
|
||||||
|
if isempty(id)
|
||||||
|
error(['Unknown variable (' options_.varobs{i} ')!'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
% Check that a variable is not declared as observed more than once.
|
||||||
|
if ~isequal(varobs,unique(varobs))
|
||||||
|
for i = 1:options_.number_of_observed_variables
|
||||||
|
if length(strmatch(varobs{i},varobs))>1
|
||||||
|
error(['A variable cannot be declared as observed more than once (' options_.varobs{i} ')!'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1:M_.endo_nbr
|
||||||
tmp = strmatch(deblank(M_.endo_names(i,:)),options_.varobs,'exact');
|
tmp = strmatch(deblank(M_.endo_names(i,:)),options_.varobs,'exact');
|
||||||
if ~isempty(tmp)
|
if isempty(tmp)
|
||||||
|
error(['Multiple declarations of ' deblank(M_.endo_names(i,:)) ' as an observed variable is not allowed!'])
|
||||||
|
else
|
||||||
if length(tmp)>1
|
if length(tmp)>1
|
||||||
skipline()
|
skipline()
|
||||||
error(['Multiple declarations of ' deblank(M_.endo_names(i,:)) ' as an observed variable is not allowed!'])
|
error(['Multiple declarations of ' deblank(M_.endo_names(i,:)) ' as an observed variable is not allowed!'])
|
||||||
end
|
end
|
||||||
options_.lgyidx2varobs(i) = tmp;
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -201,9 +201,10 @@ end
|
||||||
|
|
||||||
% Get the off-diagonal elements of the covariance matrix for the measurement errors. Test if H is positive definite.
|
% Get the off-diagonal elements of the covariance matrix for the measurement errors. Test if H is positive definite.
|
||||||
if EstimatedParameters.ncn
|
if EstimatedParameters.ncn
|
||||||
|
corrn_observable_correspondence = EstimatedParameters.corrn_observable_correspondence;
|
||||||
for i=1:EstimatedParameters.ncn
|
for i=1:EstimatedParameters.ncn
|
||||||
k1 = DynareOptions.lgyidx2varobs(EstimatedParameters.corrn(i,1));
|
k1 = corrn_observable_correspondence(i,1);
|
||||||
k2 = DynareOptions.lgyidx2varobs(EstimatedParameters.corrn(i,2));
|
k2 = corrn_observable_correspondence(i,2);
|
||||||
H(k1,k2) = xparam1(i+offset)*sqrt(H(k1,k1)*H(k2,k2));
|
H(k1,k2) = xparam1(i+offset)*sqrt(H(k1,k1)*H(k2,k2));
|
||||||
H(k2,k1) = H(k1,k2);
|
H(k2,k1) = H(k1,k2);
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue