2011-02-10 17:23:22 +01:00
|
|
|
function jndx = subset()
|
2009-12-16 18:17:34 +01:00
|
|
|
|
2011-02-10 17:23:22 +01:00
|
|
|
% Copyright (C) 2006-2011 Dynare Team
|
2009-12-16 18:17:34 +01:00
|
|
|
%
|
|
|
|
% This file is part of Dynare.
|
|
|
|
%
|
|
|
|
% Dynare is free software: you can redistribute it and/or modify
|
|
|
|
% it under the terms of the GNU General Public License as published by
|
|
|
|
% the Free Software Foundation, either version 3 of the License, or
|
|
|
|
% (at your option) any later version.
|
|
|
|
%
|
|
|
|
% Dynare is distributed in the hope that it will be useful,
|
|
|
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
% GNU General Public License for more details.
|
|
|
|
%
|
|
|
|
% You should have received a copy of the GNU General Public License
|
|
|
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
global options_ estim_params_ M_
|
|
|
|
|
|
|
|
ExcludedParamNames = options_.ExcludedParams;
|
|
|
|
info = options_.ParamSubSet;
|
|
|
|
|
|
|
|
nvx = estim_params_.nvx;
|
|
|
|
nvn = estim_params_.nvn;
|
|
|
|
ncx = estim_params_.ncx;
|
|
|
|
ncn = estim_params_.ncn;
|
|
|
|
np = estim_params_.np;
|
|
|
|
nx = nvx+nvn+ncx+ncn+np;
|
|
|
|
|
|
|
|
if strcmpi(info,'All')
|
|
|
|
indx = (1:nx)';
|
|
|
|
elseif strcmpi(info,'DeepParameters')
|
|
|
|
indx = (nvx+nvn+ncx+ncn+1:nx)';
|
|
|
|
elseif strcmpi(info,'StructuralShocks')
|
|
|
|
indx = [(1:nvx),nvx+nvn+1:nvx+nvn+ncx]';
|
|
|
|
elseif strcmpi(info,'StructuralShocksWithoutCorrelations')
|
|
|
|
indx = (1:nvx)';
|
|
|
|
elseif strcmpi(info,'MeasurementErrors')
|
|
|
|
indx = [(nvx+1:nvx+nvn),(nvx+nvn+ncx+1:nvx+nvn+ncx+ncn)]';
|
|
|
|
elseif strcmpi(info,'MeasurementErrorsWithoutCorrelations')
|
|
|
|
indx = (nvx+1:nvx+nvn)';
|
|
|
|
elseif strcmpi(info,'AllWithoutMeasurementErrors')
|
|
|
|
indx = [(1:nvx),nvx+nvn+1:nvx+nvn+ncx,nvx+nvn+ncx+ncn+1:nx]';
|
|
|
|
elseif strcmpi(info,'None')
|
|
|
|
indx = [];
|
|
|
|
end
|
|
|
|
|
|
|
|
if isempty(ExcludedParamNames)
|
|
|
|
jndx = indx;
|
|
|
|
else
|
|
|
|
tt = [];
|
|
|
|
for i = 1:length(ExcludedParamNames)
|
|
|
|
tmp = strmatch(ExcludedParamNames{i},M_.exo_names);
|
2011-02-10 17:23:22 +01:00
|
|
|
if ~isempty(tmp) && ( strcmpi(info,'All') || strcmpi(info,'StructuralShocks') || ...
|
|
|
|
strcmpi(info,'StructuralShocksWithoutCorrelations') || ...
|
2009-12-16 18:17:34 +01:00
|
|
|
strcmpi(info,'AllWithoutMeasurementErrors') )
|
|
|
|
% The parameter the user wants to exclude is related to the size of the structural innovations.
|
|
|
|
if ncx
|
|
|
|
disp(['I cannot exclude some of the structural variances if the'])
|
|
|
|
disp(['structural innovations are correlated...'])
|
|
|
|
error
|
|
|
|
end
|
|
|
|
tt = [tt;tmp];
|
2011-02-10 17:23:22 +01:00
|
|
|
elseif isempty(tmp) && nvn
|
2009-12-16 18:17:34 +01:00
|
|
|
tmp = strmatch(ExcludedParamNames{i},options_.varobs);
|
2011-02-10 17:23:22 +01:00
|
|
|
if ~isempty(tmp) && ( strcmpi(info,'All') || strcmpi(info,'MeasurementErrors') || ...
|
2009-12-16 18:17:34 +01:00
|
|
|
strcmpi(info,'MeasurementErrorsWithoutCorrelations') )
|
|
|
|
% The parameter the user wants to exclude is related to the size of the measurement errors variances.
|
|
|
|
tmp = nvx+tmp;
|
|
|
|
if ncn
|
|
|
|
disp(['I cannot exclude some the measurement error variances if the'])
|
|
|
|
disp(['measurement errors are correlated...'])
|
|
|
|
error
|
|
|
|
end
|
|
|
|
tt = [tt;tmp];
|
|
|
|
end
|
|
|
|
else% Excluded parameters are deep parameters...
|
|
|
|
tmp = strmatch(ExcludedParamNames{i},M_.param_names(estim_params_.param_vals(:,1),:),'exact');
|
|
|
|
if ~isempty(tmp)
|
|
|
|
tt = [tt;nvx+nvn+ncx+ncn+tmp];
|
|
|
|
else
|
|
|
|
disp('The parameter you want to exclude is unknown!')
|
|
|
|
error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
jndx = [];
|
|
|
|
for i=1:length(indx)
|
|
|
|
if ~any(indx(i)==tt)
|
|
|
|
jndx = [ jndx ; indx(i) ];
|
|
|
|
end
|
|
|
|
end
|
2006-11-17 14:07:57 +01:00
|
|
|
end
|