sur: small fixes

time-shift
Houtan Bastani 2019-01-11 16:44:49 +01:00
parent ef391b1304
commit 934a22c3a7
No known key found for this signature in database
GPG Key ID: 000094FB955BE169
1 changed files with 12 additions and 9 deletions

View File

@ -60,13 +60,6 @@ if nargin == 1 && size(X, 2) ~= M_.param_nbr
warning(['Not all parameters were used in model: ' strjoin(setdiff(M_.param_names, X.name), ', ')]);
end
% constrained_param_idxs: indexes in X.name of parameters that were constrained
constrained_param_idxs = zeros(length(constrained), 1);
for i = 1:length(constrained)
constrained_param_idxs(i, 1) = find(strcmp(X.name, constrained{i}));
end
constrained_params_str = strjoin(X.name(constrained_param_idxs), ', ');
if ~isempty(param_names)
newX = dseries();
nparams = length(param_names);
@ -99,7 +92,7 @@ end
%% Return to surgibbs if called from there
st = dbstack(1);
if strcmp(st(1).name, 'surgibbs')
varargout{1} = nobs; %dof
varargout{1} = nobs;
varargout{2} = opidxs;
varargout{3} = X.data;
varargout{4} = Y.data;
@ -107,6 +100,15 @@ if strcmp(st(1).name, 'surgibbs')
return
end
% constrained_param_idxs: indexes in X.name of parameters that were constrained
constrained_param_idxs = [];
for i = 1:length(constrained)
idx = find(strcmp(X.name, constrained{i}));
if ~isempty(idx)
constrained_param_idxs(end+1, 1) = idx;
end
end
%% Estimation
oo_.sur.dof = nobs;
@ -164,7 +166,8 @@ if ~options_.noprint
sprintf('Durbin-Watson: %f', oo_.sur.dw)};
if ~isempty(constrained_param_idxs)
afterward = [afterward, ['Constrained parameters: ' constrained_params_str]];
afterward = [afterward, ['Constrained parameters: ' ...
strjoin(X.name(constrained_param_idxs), ', ')]];
end
dyn_table('SUR Estimation', preamble, afterward, X.name, ...