Gradient of function, or Jacobian if function f returns 1d array
Parameters : | x : array
f : function
epsilon : float, optional
args : tuple
kwargs : dict
centered : bool
|
---|---|
Returns : | grad : array
|
Notes
If f returns a 1d array, it returns a Jacobian. If a 2d array is returned by f (e.g., with a value for each observation), it returns a 3d array with the Jacobian of each observation with shape xk x nobs x xk. I.e., the Jacobian of the first observation would be [:, 0, :]