numHessian: Calculate Hessian or Information Matrix
Description
Calculate a numerical approximation to the Hessian matrix of a
function at a parameter value.
Usage
numHessian(func, theta, h = 0.0001, method=c("fast", "easy"), ...)
Value
An p by p matrix of the Hessian of the function calculated at the
point theta. If the func is a log likelihood function,
then the negative of the p by p matrix is the information matrix.
Arguments
func
a function for which the first (vector) argument
is used as a parameter vector.
theta
the parameter vector first argument to func.
h
the step used in the numerical calculation.
method
one of "fast" or "easy" indicating
the method to use for the approximation.
...
additional named or unmaned arguments to be passed to func.
Details
The function numHessian calculates an numerical approximation to
the p by p second order derivative of a scalar real valued function with p-vector
argument theta.
This function can be used to check if the information matrix of a log likelihood is correct or not.