View source: R/nimbleFunction_Rderivs.R
nimDerivs | R Documentation |
Computes the value, 1st order (Jacobian), and 2nd order (Hessian) derivatives of a given
nimbleFunction
method and/or model log probabilities
nimDerivs(call = NA, wrt = NULL, order = nimC(0, 1, 2), model = NA, ...)
call |
a call to a |
wrt |
a character vector of either: names of function arguments
(if taking derivatives of a |
order |
an integer vector with values within the set |
model |
(optional) for derivatives of a nimbleFunction that involves model.
calculations, the uncompiled model that is used. This is needed in order
to be able to correctly restore values into the model when |
... |
additional arguments intended for internal use only. |
Derivatives for uncompiled nimbleFunctions are calculated using the
numDeriv
package. If this package is not installed, an error will
be issued. Derivatives for matrix valued arguments will be returned in
column-major order.
a nimbleList
with elements value
, jacobian
,
and hessian
.
## Not run:
model <- nimbleModel(code = ...)
calcDerivs <- nimDerivs(model$calculate(model$getDependencies('x')),
wrt = 'x')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.