From cf35496c0615acf5cdaaacb75835f6cf47bb4b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemia=20=28Scylla=29?= Date: Wed, 21 Nov 2018 15:21:23 +0100 Subject: [PATCH] Fixed bug in the evaluation of the sum of squared residuals (PAC/NLS). --- matlab/+pac/+estimate/nls.m | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/matlab/+pac/+estimate/nls.m b/matlab/+pac/+estimate/nls.m index 308ff234a..c21001d48 100644 --- a/matlab/+pac/+estimate/nls.m +++ b/matlab/+pac/+estimate/nls.m @@ -130,14 +130,10 @@ for i=1:length(ipnames_) fprintf(fid, 'DynareModel.params(%u) = params(%u);\n', ipnames_(i), i); end fprintf(fid, '\n'); -fprintf(fid, 'DynareModel = pac.update.parameters(''%s'', DynareModel, DynareOutput);\n', ... - pacmodl); +fprintf(fid, 'DynareModel = pac.update.parameters(''%s'', DynareModel, DynareOutput);\n', pacmodl); fprintf(fid, '\n'); fprintf(fid, 'r = %s-(%s);\n', lhs, rhs); -fprintf(fid, 's = .0;\n'); -fprintf(fid, 'for i=1:%u\n', range.length()-islaggedvariables); -fprintf(fid, ' s = s + r(i)*r(i);\n'); -fprintf(fid, 'end\n'); +fprintf(fid, 's = r''*r;\n'); fclose(fid); % Create a function handle returning the sum of square residuals for a given