Skip to content
Prev 379032 / 398502 Next

problem with nls....

On Fri, 22 Mar 2019 12:29:14 +0000
akshay kulkarni <akshay_e4 at hotmail.com> wrote:

            
nls() return value is a list containing an entry named `m`, which is an
object of type "nlsModel". It doesn't seem to be documented in modern
versions of R[*], so what I am describing might be an implementation
detail subject to change. Still, model$m$gradient() should return the
jacobian; Hessian is usually estimated as crossprod() of jacobian; and
the gradient of the objective function is computed as
-2*colSums(model$m$resid() * model$m$gradient()).
The more important question is, how does the objective function (sum of
squared residuals) depend on the parameter `m` you are trying to find?
Try computing it for various values of `m` and looking at the result:

plot(
	Vectorize(
		function(m) {
			model$m$setPars(m);
			model$m$deviance()
		}
	),
	from = ..., to = ... # fill as needed
)