statsmodels.tools.numdiff.approx_hess3

statsmodels.tools.numdiff.approx_hess3(x, f, epsilon=None, args=(), kwargs={})[source]

Calculate Hessian with finite difference derivative approximation

Parameters:
xarray_like

value at which function derivative is evaluated

ffunction

function of one array f(x, *args, **kwargs)

epsilonfloat or array_like, optional

Stepsize used, if None, then stepsize is automatically chosen according to EPS**(1/4)*x.

argstuple

Arguments for function f.

kwargsdict

Keyword arguments for function f.

Returns:
hessndarray

array of partial second derivatives, Hessian

Notes

Equation (9) in Ridout. Computes the Hessian as:

1/(4*d_j*d_k) * ((f(x + d[j]*e[j] + d[k]*e[k]) - f(x + d[j]*e[j]
                                                   - d[k]*e[k])) -
               (f(x - d[j]*e[j] + d[k]*e[k]) - f(x - d[j]*e[j]
                                                   - d[k]*e[k]))

where e[j] is a vector with element j == 1 and the rest are zero and d[i] is epsilon[i].

References

Ridout, M.S. (2009) Statistical applications of the complex-step method

of numerical differentiation. The American Statistician, 63, 66-74

This is an alias for approx_hess3


Last update: Dec 23, 2024