numerical derivative
[g]=numz0(namefunc,param,k,g,delta,varargin)
namefunc = name of function namefunc with the parameters as first argument
param = point where the derivative is calculated
k = dimension of param
g = a pre-determinated matrix with dimension (k,n) where n is the dimension of namefunc
delta = the Increment used to evaluate the derivative
argi = argument other than param in function namefunc
g = numerical derivative
1) eqn=numz0('ssr',ols0(y,x),size(x,2),ones(size(x,2)),1E-5,y,x) 2)chg='numz0('''+func+''',xarg,k,ik,infoz(''delta''), varargin(:))';execstr(chg) The first example provides the value of the normal equations evaluated at the ols estimator: the results should be approximately (since numz0 calculates a numerical derivative) 0. Example 2, taken from maxlik, provides a numerical derivative of function func, at value xarg, of dimension (k x 1), with an increment taken from infoz. | ![]() | ![]() |