nlregb(nres, start, residuals, jacobian = NULL, scale = NULL, control = NULL, lower = -Inf, upper = Inf, ...)
For best results, the Jacobian matrix of the residuals should be supplied whenever possible.
Function and derivative values should be computed in C or Fortran within the outer S-PLUS function for greater efficiency.
A. T. & T. Bell Laboratories (1984). PORT Mathematical Subroutine Library Manual.
Dongarra, J. J. and Grosse, E. (1987). Distribution of mathematical software via electronic mail, Communications of the ACM, 30, pp. 403-407.
Dennis, J. E., Gay, D. M., and Welsch, R. E. (1981). An Adaptive Nonlinear Least-Squares Algorithm ACM Transactions on Mathematical Software, 7, pp. 348-368.
Dennis, J. E., Gay, D. M., and Welsch, R. E. (1981). Algorithm 573. NL2SOL - An Adaptive Nonlinear Least-Squares Algorithm. ACM Transactions on Mathematical Software, 7, pp. 369-383.
Gay, D. M. (1984). A trust region approach to linearly constrained optimization. in Numerical Analysis. Proceedings, Dundee 1983, F. A Lootsma (ed.), Springer, Berlin, pp. 171-189.
# this example uses nlregb to solve a linear least-squares problemn <- 20; p <- 5 A <- matrix(rnorm(n*p), nrow = n, ncol = p) x <- rep(1, p) x0 <- rnorm(length(x))
lin.res <- function(x, y, A) {A%*%x-y} nlregb(nres = n, start = x0, res = lin.res, y = A%*%x, A = A)
# now try it with bounds with a solution partially outside the bounds
x <- c(0, -2, 0, 2, 0) nlregb(nres = n, st = x0, res = lin.res, lo = -1, up = 1, y = A%*%x, A = A)
# now use the Jacobian matrix
lin.jac <- function(x, y, A) {A} nlregb(nres = n, st = x0, res = lin.res, jac = lin.jac, lo = -1, up = 1, y = A%*%x, A = A)