DerivLogf {docopulae} | R Documentation |
Build Derivative Function for Log f
Description
DerivLogf
/Deriv2Logf
builds a function that evaluates to the first/second derivative of log(f(y, theta, ...))
with respect to theta[[i]]
/theta[[i]]
and theta[[j]]
.
Usage
DerivLogf(f, parNames, preSimplify = T, ...)
Deriv2Logf(f, parNames, preSimplify = T, ...)
Arguments
f |
|
parNames |
a vector of names or indices, the subset of parameters to use. |
preSimplify |
simplify the body of |
... |
other arguments passed to |
Details
While numDerivLogf
relies on the package numDeriv and therefore uses finite differences to evaluate the derivatives, DerivLogf
utilizes the package Deriv to build sub functions for each parameter in parNames
.
The same is true for Deriv2Logf
.
Value
DerivLogf
returns function(y, theta, i, ...)
which evaluates to the first derivative of log(f(y, theta, ...))
with respect to theta[[i]]
.
The attribute "d"
contains the list of sub functions.
Deriv2Logf
returns function(y, theta, i, j, ...)
which evaluates to the second derivative of log(f(y, theta, ...))
with respect to theta[[i]]
and theta[[j]]
.
The attribute "d2"
contains the list of sub functions.
See Also
Deriv, Deriv
in package Deriv, buildf
, numDerivLogf
, fisherI
Examples
## see examples for param
## mind the gain regarding runtime compared to numDeriv