nls_test_problem function

Retrieve an NLS test problem

Retrieve an NLS test problem

Fetches the model definition and model data required to solve a single NLS test problem with gsl_nls

(or nls if the model is defined as a formula ). Use nls_test_list to list the names of the available NLS test problems.

nls_test_problem(name, p = NA, n = NA)

Arguments

  • name: Name of the NLS test problem, as returned in the "name" column of nls_test_list.
  • p: The number of parameters in the NLS test problem constrained by the check condition returned by nls_test_list. If NA (default), the default number of parameters as listed by nls_test_list is used.
  • n: The number of residuals in the NLS test problem constrained by the check condition returned by nls_test_list. If NA (default), the default number of residuals as listed by nls_test_list is used.

Returns

If the model is defined as a formula , a list of class "nls_test_formula" with elements:

  • data a data.frame with n rows containing the data (predictor and response values) used in the regression problem.
  • fn a formula defining the test problem model.
  • start a named vector of length p with suggested starting values for the parameters.
  • target a named vector of length p with the certified target values for the parameters corresponding to the best-available solutions.

If the model is defined as a function , a list of class "nls_test_function" with elements:

  • fn a function defining the test problem model. fn takes a vector of parameters of length p as its first argument and returns a numeric vector of length n. fn

  • y a numeric vector of length n containing the response values.

  • start a numeric named vector of length p with suggested starting values for the parameters.

  • jac a function defining the analytic Jacobian matrix of the model fn. jac

    takes a vector of parameters of length p as its first argument and returns an n by p dimensional matrix.

  • target a numeric named vector of length p with the certified target values for the parameters, or a vector of NA's if no target solution is available.

Note

For several problems the optimal least-squares objective of the target solution can be obtained at multiple different parameter locations.

Examples

## example regression problem ratkowsky2 <- nls_test_problem(name = "Ratkowsky2") with(ratkowsky2, gsl_nls( fn = fn, data = data, start = start ) ) ## example optimization problem rosenbrock <- nls_test_problem(name = "Rosenbrock") with(rosenbrock, gsl_nls( fn = fn, y = y, start = start, jac = jac ) )

References

D.M. Bates and Watts, D.G. (1988). Nonlinear Regression Analysis and Its Applications, Wiley, ISBN: 0471816434.

J.J. Moré, Garbow, B.S. and Hillstrom, K.E. (1981). Testing unconstrained optimization software, ACM Transactions on Mathematical Software, 7(1), 17-41.

See Also

nls_test_list

https://www.itl.nist.gov/div898/strd/nls/nls_main.shtml

https://people.math.sc.edu/Burkardt/f_src/test_nls/test_nls.html

  • Maintainer: Joris Chau
  • License: LGPL-3
  • Last published: 2025-01-17