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
parent
4512000f0f
commit
8fa8ee8235
|
@ -166,7 +166,7 @@ end
|
||||||
% List of objects to be replaced
|
% List of objects to be replaced
|
||||||
objNames = [pnames; enames; xnames];
|
objNames = [pnames; enames; xnames];
|
||||||
objIndex = [pid; eid; xid];
|
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');
|
[~,I] = sort(cellfun(@length, objNames), 'descend');
|
||||||
objNames = objNames(I);
|
objNames = objNames(I);
|
||||||
|
@ -178,7 +178,7 @@ for i=1:length(objNames)
|
||||||
switch objTypes(i)
|
switch objTypes(i)
|
||||||
case 1
|
case 1
|
||||||
rhs = strrep(rhs, objNames{i}, sprintf('DynareModel.params(%u)', objIndex(i)));
|
rhs = strrep(rhs, objNames{i}, sprintf('DynareModel.params(%u)', objIndex(i)));
|
||||||
case {2,3}
|
case 2
|
||||||
k = find(strcmp(objNames{i}, data.name));
|
k = find(strcmp(objNames{i}, data.name));
|
||||||
if isempty(k)
|
if isempty(k)
|
||||||
error('Variable %s is missing in the database.', objNames{i})
|
error('Variable %s is missing in the database.', objNames{i})
|
||||||
|
|
|
@ -87,7 +87,7 @@ end
|
||||||
% List of objects to be replaced
|
% List of objects to be replaced
|
||||||
objNames = [pnames; enames; xnames];
|
objNames = [pnames; enames; xnames];
|
||||||
objIndex = [pid; eid; xid];
|
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');
|
[~,I] = sort(cellfun(@length, objNames), 'descend');
|
||||||
objNames = objNames(I);
|
objNames = objNames(I);
|
||||||
|
@ -99,7 +99,7 @@ for i=1:length(objNames)
|
||||||
switch objTypes(i)
|
switch objTypes(i)
|
||||||
case 1
|
case 1
|
||||||
rhs = strrep(rhs, objNames{i}, sprintf('DynareModel.params(%u)', objIndex(i)));
|
rhs = strrep(rhs, objNames{i}, sprintf('DynareModel.params(%u)', objIndex(i)));
|
||||||
case {2,3}
|
case 2
|
||||||
k = find(strcmp(objNames{i}, data.name));
|
k = find(strcmp(objNames{i}, data.name));
|
||||||
if isempty(k)
|
if isempty(k)
|
||||||
error('Variable %s is missing in the database.', objNames{i})
|
error('Variable %s is missing in the database.', objNames{i})
|
||||||
|
|
Loading…
Reference in New Issue