0001 function jndx = subset()
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 global options_ estim_params_ M_
0021
0022 ExcludedParamNames = options_.ExcludedParams;
0023 VarObs = options_.varobs;
0024 VarExo = M_.exo_names;
0025 info = options_.ParamSubSet;
0026
0027 nvx = estim_params_.nvx;
0028 nvn = estim_params_.nvn;
0029 ncx = estim_params_.ncx;
0030 ncn = estim_params_.ncn;
0031 np = estim_params_.np;
0032 nx = nvx+nvn+ncx+ncn+np;
0033
0034 if strcmpi(info,'All')
0035 indx = (1:nx)';
0036 elseif strcmpi(info,'DeepParameters')
0037 indx = (nvx+nvn+ncx+ncn+1:nx)';
0038 elseif strcmpi(info,'StructuralShocks')
0039 indx = [(1:nvx),nvx+nvn+1:nvx+nvn+ncx]';
0040 elseif strcmpi(info,'StructuralShocksWithoutCorrelations')
0041 indx = (1:nvx)';
0042 elseif strcmpi(info,'MeasurementErrors')
0043 indx = [(nvx+1:nvx+nvn),(nvx+nvn+ncx+1:nvx+nvn+ncx+ncn)]';
0044 elseif strcmpi(info,'MeasurementErrorsWithoutCorrelations')
0045 indx = (nvx+1:nvx+nvn)';
0046 elseif strcmpi(info,'AllWithoutMeasurementErrors')
0047 indx = [(1:nvx),nvx+nvn+1:nvx+nvn+ncx,nvx+nvn+ncx+ncn+1:nx]';
0048 elseif strcmpi(info,'None')
0049 indx = [];
0050 end
0051
0052 if isempty(ExcludedParamNames)
0053 jndx = indx;
0054 else
0055 tt = [];
0056 for i = 1:length(ExcludedParamNames)
0057 tmp = strmatch(ExcludedParamNames{i},M_.exo_names);
0058 if ~isempty(tmp) && ( strcmpi(info,'All') || strcmpi(info,'StructuralShocks') || ...
0059 strcmpi(info,'StructuralShocksWithoutCorrelations') || ...
0060 strcmpi(info,'AllWithoutMeasurementErrors') )
0061
0062 if ncx
0063 disp(['I cannot exclude some of the structural variances if the'])
0064 disp(['structural innovations are correlated...'])
0065 error
0066 end
0067 tt = [tt;tmp];
0068 elseif isempty(tmp) && nvn
0069 tmp = strmatch(ExcludedParamNames{i},options_.varobs);
0070 if ~isempty(tmp) && ( strcmpi(info,'All') || strcmpi(info,'MeasurementErrors') || ...
0071 strcmpi(info,'MeasurementErrorsWithoutCorrelations') )
0072
0073 tmp = nvx+tmp;
0074 if ncn
0075 disp(['I cannot exclude some the measurement error variances if the'])
0076 disp(['measurement errors are correlated...'])
0077 error
0078 end
0079 tt = [tt;tmp];
0080 end
0081 else
0082 tmp = strmatch(ExcludedParamNames{i},M_.param_names(estim_params_.param_vals(:,1),:),'exact');
0083 if ~isempty(tmp)
0084 tt = [tt;nvx+nvn+ncx+ncn+tmp];
0085 else
0086 disp('The parameter you want to exclude is unknown!')
0087 error
0088 end
0089 end
0090 end
0091 jndx = [];
0092 for i=1:length(indx)
0093 if ~any(indx(i)==tt)
0094 jndx = [ jndx ; indx(i) ];
0095 end
0096 end
0097 end