Description Usage Arguments Details Value Note Author(s) Examples
There are two functions provided, funcheck
and funtest
.
funcheck
works on a source code file containing several functions with
a common root to their name. Thus, a file 'hobbs.R' may contain code for several
functions:
the objective function to be minimized or maximized. This takes as arguments a vector of parameters and local variables specified via the "..." inputs.
the gradient of that function
the hessian of that funciton
if hobbs.f is formed as a sum of squares, then this function returns a vector of residuals such that the sum of their squares is the function value
to compute the Jacobian of the residuals above
to compute the second derivatives of the residuals above
to provide starting values and bounds for the functions above
For funtest
, the functions are specified explicitly.
1 2 |
xpar |
a matrix with rows each being a vector giving the numerical values of an initial point where the function should be tested. |
fname |
the base name (as a character string) of a file of type .R that contains functions fname.f to compute the scalar objective function value at a given set of parameters in the vector x, where x is of length n, with (optionally) fname.g for the gradient, fname.res for residuals in the case that the scalar objective function is a sum of m squared elements, fname.jac for the Jacobian of these residuals, fname.setup to set up the xset, as well as lower and upper bounds and the bounds and masks indicator (integer) vector bdmsk, and fname.h for the Hessian. |
fn |
explicit name for the objective function |
gr |
explicit name for the gradient function |
hess |
explicit name for the Hessian function |
res |
explicit name for the residual function |
jac |
explicit name for the Jacobian function |
rsd |
explicit name for the residual second derivative function |
lower |
a matrix whose rows are sets of lower bounds on the parameters to the function |
upper |
a matrix whose rows are sets of upper bounds on the parameters to the function |
cctrl |
list of control parameters. |
... |
optional arguments passed to the objective function. |
Package: | funcheck |
Depends: | R (>= 2.6.1) |
License: | GPL Version 2. |
Algorithm
funcheck assumes that the user supplies functions in the file fname.R that is accessible from the global environment.
funtest assumes that the functions called are already in the current environment.
A list of lists, one list for each set of parameters (each row) of xset. Each sublist has the following components:
fname |
The name of the test function file. |
ipoint |
An index counter for the test points. |
par |
The numerical values of the n elements of the supplied parameters.. |
lower |
Lower bounds for the parameters in this case. |
upper |
Lower bounds for the parameters in this case. |
bstate |
A character vector telling whether each parameter is Out of Bounds Low, In Bounds, or Out of Bounds High. |
grd |
The max. abs. relative difference with denominator augmented by 10. for the gradient. |
Jrd |
The max. abs. relative difference with denominator augmented by 10. for the Jacobian. |
jsdrd |
The max. abs. relative difference with denominator augmented by 10. for the Jacobian second derivatives. |
Hrd |
The max. abs. relative difference with denominator augmented by 10. for the Hessian. |
These versions of funcheck and funtest are not optimized.
The following code must be stored in file tryfun.R and available to the tests. ??how?? ??where??
John C. Nash
1 2 3 | ## the file tryfun.R must be available in the current directory
#don't execute -- ans<-funcheck(xpar = rep(10.0,10), fname="tryfun")
# The above example is in the tests
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.