Learn R Programming

docopulae (version 0.2.1)

numDerivLogf: Build Derivative Function for Log f

Description

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, logZero = .Machine$double.xmin,
  logInf = .Machine$double.xmax/2, method = "Richardson",
  method.args = list(eps = 1e-04, d = 0.1, zero.tol =
  sqrt(.Machine$double.eps/7e-07), r = 4, v = 2, show.details = F))

numDeriv2Logf(f, logZero = .Machine$double.xmin, logInf = .Machine$double.xmax/2, method = "Richardson", method.args = list(eps = 1e-04, d = 0.1, zero.tol = sqrt(.Machine$double.eps/7e-07), r = 4, v = 2, show.details = F))

Arguments

f
function(y, theta, ...), where theta is a list of parameters. A joint probability density function.
logZero
the value log(f) should return if f evaluates to 0.
logInf
the value log(f) should return if f evaluates to Inf.
method
see numDeriv
method.args
see numDeriv

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]].

Details

numDeriv produces NaNs if the log evaluates to (negative) Inf so you may want to specify logZero and logInf.

See Also

numDeriv, buildf, DerivLogf, fisherI

Examples

Run this code
## see examples for param

Run the code above in your browser using DataLab