new function to select a subset of deep parameters.
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1082 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
ce51ccc7b3
commit
86e196c515
|
@ -0,0 +1,80 @@
|
|||
function jndx = subset();
|
||||
% stephane.adjemian@ens.fr [11-30-2005]
|
||||
global options_ estim_params_ M_
|
||||
|
||||
ExcludedParamNames = options_.ExcludedParams;
|
||||
VarObs = options_.varobs;
|
||||
VarExo = M_.exo_names;
|
||||
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);
|
||||
if ~isempty(tmp) & ( strcmpi(info,'All') | strcmpi(info,'StructuralShocks') | ...
|
||||
strcmpi(info,'StructuralShocksWithoutCorrelations') | ...
|
||||
strcmpi(info,'AllWithoutMeasurementErros') )
|
||||
% The parameter the user wants to exclude is related to the size of the structural innovations.
|
||||
if ncx
|
||||
disp(['I cannot exclude some the structural variances if the'])
|
||||
disp(['structural innovations are correlated...'])
|
||||
error
|
||||
end
|
||||
tt = [tt;tmp];
|
||||
elseif isempty(tmp) & nvn
|
||||
tmp = strmatch(ExcludedParamNames{i},options_.varobs);
|
||||
if ~isempty(tmp) & ( strcmpi(info,'All') | strcmpi(info,'MeasurementErrors') | ...
|
||||
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,'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
|
||||
end
|
Loading…
Reference in New Issue