numDerivLogf {docopulae} | R Documentation |
Build Derivative Function for Log f
Description
numDerivLogf
/numDeriv2Logf
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
numDerivLogf(f, isLogf = FALSE, logZero = .Machine$double.xmin,
logInf = .Machine$double.xmax/2, method = "Richardson",
side = NULL, method.args = list())
numDeriv2Logf(f, isLogf = FALSE, logZero = .Machine$double.xmin,
logInf = .Machine$double.xmax/2, method = "Richardson",
method.args = list())
Arguments
f |
|
isLogf |
set to |
logZero |
the value |
logInf |
the value |
method , side , method.args |
Details
numDeriv produces NaN
s if the log evaluates to (negative) Inf
so you may want to specify logZero
and logInf
.
numDerivLogf
passes method
, side
and method.args
directly to numDeriv::grad
.
numDeriv2Logf
duplicates the internals of numDeriv::hessian
to gain speed.
The defaults for method.args
are list(eps=1e-4, d=0.1, zero.tol=sqrt(.Machine$double.eps/7e-7), r=4, v=2)
.
Value
numDerivLogf
returns function(y, theta, i, ...)
which evaluates to the first derivative of log(f(y, theta, ...))
with respect to theta[[i]]
.
numDeriv2Logf
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]]
.
See Also
grad
and hessian
in package numDeriv, buildf
, DerivLogf
, fisherI
Examples
## see examples for param