The function calculates the numerical derivate of an objective function using central difference. It is a relatively quick way to obtain the score contribution of each observation when the optimizer requires a single value.

num_deriv(param, log_lik, N, eps)

Arguments

param

A vector of parameters

log_lik

The log-likelihood function

N

The number of observations, e.g. individuals

eps

The precision level

Value

A matrix with rows equal to N and columns equal to the number of parameters