View source: R/HelperFunctions.R
| approx_grad | R Documentation |
Computes a finite-difference approximation derived from the objective in
fn at x, returned in the sign convention currently used by
efficient_bfgs.
approx_grad(x, fn, eps = sqrt(.Machine$double.eps))
x |
Numeric vector of function arguments |
fn |
Function returning list(objective, gradient) |
eps |
Numeric scalar, finite difference tolerance |
Used within efficient_bfgs when fn does not supply a usable
gradient. In the main lgspline() correlation-optimization path,
stats::optim() is used instead when no analytic REML gradient is
available. Internally this helper returns the negated central-difference
approximation rather than the raw derivative.
Numeric vector of finite-difference approximated gradient values in the current optimizer sign convention
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.