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.
multiRoot(func, theta, ..., verbose = FALSE, maxIter = 50,
thetaUp = NULL, thetaLow = NULL, tol = .Machine$double.eps^0.25)
A list with at least four components:
a vector of theta that solves func(theta) = 0.
a vector of f(root) that evaluates at theta = root.
number of iteratins used in the algorithm.
1 if the algorithm converges, 0 otherwise.
a m-vector function for which the root is sought.
the parameter vector first argument to func.
the lower bound of theta.
the upper bound of theta.
print out the verbose, default is FALSE.
the maximum number of iterations, default is 20.
the desired accuracy (convergence tolerance), default is .Machine$double.eps^0.25.
an additional named or unmaned arguments to be passed to func
.
Bingshu E. Chen (bingshu.chen@queensu.ca)
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.
Gauss, Carl Friedrich(1809). Theoria motus corporum coelestium in sectionibus conicis solem ambientum.
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)
Run the code above in your browser using DataLab