From 40f4055e6ba4ed836dc4765501c8147a2f5961c9 Mon Sep 17 00:00:00 2001 From: Suraj Yerramilli Date: Fri, 12 Feb 2016 13:26:31 +0530 Subject: updating residuals only when there is a decrease --- R/estUtil.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/estUtil.R b/R/estUtil.R index 21e132f..f6f5619 100644 --- a/R/estUtil.R +++ b/R/estUtil.R @@ -31,8 +31,8 @@ levbmqdt <- function(...,obj,theta0,N,opt){ theta <- theta0 + Hinv%*%g # Update residuals - e <- l$Y-l$X%*%theta - sumsq <- sum(e^2) + fn <- l$Y-l$X%*%theta + sumsq <- sum(fn^2) sumSqDiff <- sumsq0-sumsq countObj <- countObj + 1 @@ -44,6 +44,7 @@ levbmqdt <- function(...,obj,theta0,N,opt){ d <- d/mu theta0 <- theta sumsq0 <- sumsq + e <- fn break } else{ # increase damping coefficient by a factor of mu d <- d*mu -- cgit