Bug fix (wrong dimension for exogenous variables).

Also removed the distinction between exogenous and endogenous variables when
replacing variables by columns in the data matrix.
nls-fixes
Stéphane Adjemian (Ryûk) 2021-12-17 20:18:50 +01:00
parent 4512000f0f
commit 8fa8ee8235
Signed by: stepan
GPG Key ID: 295C1FE89E17EB3C
2 changed files with 4 additions and 4 deletions

View File

@ -166,7 +166,7 @@ end
% List of objects to be replaced
objNames = [pnames; enames; xnames];
objIndex = [pid; eid; xid];
objTypes = [ones(length(pid), 1); 2*ones(length(eid), 1); 3*ones(length(eid), 1);];
objTypes = [ones(length(pid), 1); 2*ones(length(eid)+length(xid), 1)];
[~,I] = sort(cellfun(@length, objNames), 'descend');
objNames = objNames(I);
@ -178,7 +178,7 @@ for i=1:length(objNames)
switch objTypes(i)
case 1
rhs = strrep(rhs, objNames{i}, sprintf('DynareModel.params(%u)', objIndex(i)));
case {2,3}
case 2
k = find(strcmp(objNames{i}, data.name));
if isempty(k)
error('Variable %s is missing in the database.', objNames{i})

View File

@ -87,7 +87,7 @@ end
% List of objects to be replaced
objNames = [pnames; enames; xnames];
objIndex = [pid; eid; xid];
objTypes = [ones(length(pid), 1); 2*ones(length(eid), 1); 3*ones(length(eid), 1);];
objTypes = [ones(length(pid), 1); 2*ones(length(eid)+length(xid), 1)];
[~,I] = sort(cellfun(@length, objNames), 'descend');
objNames = objNames(I);
@ -99,7 +99,7 @@ for i=1:length(objNames)
switch objTypes(i)
case 1
rhs = strrep(rhs, objNames{i}, sprintf('DynareModel.params(%u)', objIndex(i)));
case {2,3}
case 2
k = find(strcmp(objNames{i}, data.name));
if isempty(k)
error('Variable %s is missing in the database.', objNames{i})