multiRoot: m-Dimensional Root (Zero) Finding

View source: R/bhm_lib.R

multiRootR Documentation

m-Dimensional Root (Zero) Finding

Description

The function multiRoot searches for root (i.e, zero) of the vector-valued function func with respect to its first argument using the Gauss-Newton algorithm.

Usage

    multiRoot(func, theta, ..., verbose = FALSE, maxIter = 20, tol = .Machine$double.eps^0.25)

Arguments

func

a m-vector function for which the root is sought.

theta

the parameter vector first argument to func.

...

an additional named or unmaned arguments to be passed to func.

verbose

print out the verbose, default is FALSE.

maxIter

the maximum number of iterations, default is 20.

tol

the desired accuracy (convergence tolerance), default is .Machine$double.eps^0.25.

Details

The function multiRoot finds an numerical approximation to func(theta) = 0 using Newton method: theta = theta - solve(J, func(theta)) when m = p. This function can be used to solve the score function euqations for a maximum log likelihood estimate.

This function make use of numJacobian calculates an numerical approximation to the m by p first order derivative of a m-vector valued function. The parameter theta is updated by the Gauss-Newton method:

theta = theta - solve((t(J) x J), J x func(theta))

When m > p, if the nonlinear system has not solution, the method attempts to find a solution in the non-linear least squares sense (Gauss-Newton algorithm). The sum of square sum(t(U)xU), where U = func(theta), will be minimized.

Value

A list with at least four components:

root

a vector of theta that solves func(theta) = 0.

f.root

a vector of f(root) that evaluates at theta = root.

iter

number of iteratins used in the algorithm.

convergence

1 if the algorithm converges, 0 otherwise.

Author(s)

Bingshu E. Chen (bingshu.chen@queensu.ca)

References

Gauss, Carl Friedrich(1809). Theoria motus corporum coelestium in sectionibus conicis solem ambientum.

See Also

optim (which is preferred) and nlm, nlminb, numJacobian, numScore, optimize and uniroot for one-dimension optimization.

Examples

  g = function(x, a) (c(x[1]+2*x[2]^3, x[2] - x[3]^3, a*sin(x[1]*x[2])))
  theta = c(1, 2, 3)
  multiRoot(g, theta, a = -3)

statapps/bhm documentation built on April 5, 2024, 3:31 a.m.