resgr: resgr

View source: R/resJacFns.R

resgrR Documentation

resgr

Description

Computes the gradient of the sum of squares function for nonlinear least squares where resfn and jacfn supply the residuals and Jacobian

Usage

resgr(prm, resfn, jacfn, ...)

Arguments

prm

a numeric vector of parameters to the model

resfn

a function to compute a vector of residuals

jacfn

a function to compute the Jacobian of the sum of squares. If the value is quoted, then the function is assumed to be a numerical approximation. Currently one of "jafwd", "jaback", "jacentral", or "jand".

...

Extra information needed to compute the residuals

Details

Does NOT (yet) handle calling of code built into selfStart models. That is, codes that in nlxb employ control japprox="SSJac".

Value

The main object returned is the numeric vector of residuals computed at prm by means of the function resfn. There are Jacobian and gradient attributes giving the Jacobian (matrix of 1st partial derivatives whose row i contains the partial derivative of the i'th residual w.r.t. each of the parameters) and the gradient of the sum of squared residuals w.r.t. each of the parameters. Moreover, the Jacobian is repeated within the gradient attribute of the Jacobian. This somewhat bizarre structure is present for compatibility with nls() and some other legacy functions, as well as to simplify the call to nlfb().

Author(s)

J C Nash 2014-7-16 revised 2022-11-22 nashjc _at_ uottawa.ca


nlsr documentation built on Sept. 8, 2023, 5:48 p.m.