hessian: Approximation of Hessian matrix

Description Usage Arguments Details Value Examples

View source: R/auxiliar_functions.r

Description

hessian uses forward difference to approximate the matrix of second derivatives of fun at param.

Usage

1
  hessian(fun, param, ..., fun0 = NULL)

Arguments

fun

Function whose hessian matrix is to be approximated.

param

Numeric vector of parameters where fun is to be evaluated

...

Any additional arguments passed to fun.

fun0

The value of fun at param. If it is NULL, fun will be evaluated at param.

Details

The forward difference uses a step-size of the cubic root of machine epsilon. No scaling is applied to parameters.

Value

A numeric matrix whose size is determined by the length of param.

Examples

1
2
3
4
f  <- function(x) sum(x^2)
x0 <- c(1,1)
f0 <- f(x0)
hessian(f, x0, fun0 = f0)

nando11235813/raschreg documentation built on Oct. 2, 2021, 3:11 p.m.