nls_test_problem {gslnls} | R Documentation |
Retrieve an NLS test problem
Description
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.
Usage
nls_test_problem(name, p = NA, n = NA)
Arguments
name |
Name of the NLS test problem, as returned in the |
p |
The number of parameters in the NLS test problem constrained by the |
n |
The number of residuals in the NLS test problem constrained by the |
Value
If the model is defined as a formula, a list of class "nls_test_formula"
with elements:
-
data
a data.frame withn
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 lengthp
with suggested starting values for the parameters. -
target
a named vector of lengthp
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 lengthp
as its first argument and returns a numeric vector of lengthn
.fn
-
y
a numeric vector of lengthn
containing the response values. -
start
a numeric named vector of lengthp
with suggested starting values for the parameters. -
jac
a function defining the analytic Jacobian matrix of the modelfn
.jac
takes a vector of parameters of lengthp
as its first argument and returns ann
byp
dimensional matrix. -
target
a numeric named vector of lengthp
with the certified target values for the parameters, or a vector ofNA
'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.
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
https://www.itl.nist.gov/div898/strd/nls/nls_main.shtml
https://people.math.sc.edu/Burkardt/f_src/test_nls/test_nls.html
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
)
)