r - "plinear" algorithm of nls -
i trying implement similar nls optimization using "plinear" algorithm having trouble in deciphering implementation of algorithm in nls package.(https://github.com/surajgupta/r-source/blob/master/src/library/stats/r/nls.r)
there section in above code convergence criteria , increament of parameter estimates computed (as shown below). nls package documentation says "plinear" follows variable projection algorithm golub , pereyra variable projection paper (http://iopscience.iop.org/article/10.1088/0266-5611/19/2/201/meta). have gone through article still having trouble in understanding done below:
conv = function() { assign("cc", c(topzero, qr.qty(qr.rhs, .swts * lhs)[ -(1l:p1)]), envir = thisenv) rr <- qr.qy(qr.rhs, cc) b <- qr.qty(qr.rhs, .swts * ddot(attr(rhs, "gradient"), lin)) b[1l:p1, ] <- dtdot(.swts * attr(rhs, "gradient"), rr) r <- t( qr.r(qr.rhs)[1l:p1, ] ) if(p1 == 1) b[1, ] <- b[1, ]/r else b[1l:p1, ] <- forwardsolve(r, b[1l:p1, ]) assign("qr.b", qr(b), envir = thisenv) rr <- qr.qty(qr.b, cc) sqrt( fac*sum(rr[1l:p1]^2) / sum(rr[-(1l:p1)]^2) ) }, incr = function() qr.solve(qr.b, cc)
it great if can illustrate above?
Comments
Post a Comment