Top |
double | (*BFGS_CRIT_FUNC) () |
int | (*BFGS_GRAD_FUNC) () |
double | (*BFGS_COMBO_FUNC) () |
const double * | (*BFGS_LLT_FUNC) () |
int | (*HESS_FUNC) () |
double | (*ZFUNC) () |
int | BFGS_max () |
int | LBFGS_max () |
int | newton_raphson_max () |
int | BFGS_numeric_gradient () |
gretl_matrix * | numerical_score_matrix () |
int | hessian_from_score () |
gretl_matrix * | hessian_inverse_from_score () |
int | numerical_hessian () |
gretl_matrix * | numerical_hessian_inverse () |
double | user_BFGS () |
double | user_NR () |
double | deriv_free_optimize () |
gretl_matrix * | user_fdjac () |
gretl_matrix * | user_numhess () |
int | gretl_simann () |
int | gretl_amoeba () |
int | gretl_fzero () |
int | gretl_gss () |
void | BFGS_defaults () |
int | optimizer_get_matrix_name () |
int | numgrad_in_progress () |
int (*BFGS_GRAD_FUNC) (double *Param1
,double *Param2
,int Param3
,BFGS_CRIT_FUNC Param4
,void *Param5
);
double (*BFGS_COMBO_FUNC) (double *Param1
,double *Param2
,int Param3
,void *Param4
);
int BFGS_max (double *b
,int n
,int maxit
,double reltol
,int *fncount
,int *grcount
,BFGS_CRIT_FUNC cfunc
,int crittype
,BFGS_GRAD_FUNC gradfunc
,void *data
,const gretl_matrix *A0
,gretlopt opt
,PRN *prn
);
Obtains the set of values for b
which jointly maximize the
criterion value as calculated by cfunc
. By default uses the BFGS
variable-metric method (based on Pascal code in J. C. Nash,
"Compact Numerical Methods for Computers," 2nd edition, converted
by p2c then re-crafted by B. D. Ripley for gnu R; revised for
gretl by Allin Cottrell and Jack Lucchetti). Alternatively,
if OPT_L is given, uses the L-BFGS-B method (limited memory
BFGS), based on Lbfgsb.3.0 by Ciyou Zhu, Richard Byrd, Jorge
Nocedal and Jose Luis Morales.
b |
array of adjustable coefficients. |
|
n |
number elements in array |
|
maxit |
the maximum number of iterations to allow. |
|
reltol |
relative tolerance for terminating iteration. |
|
fncount |
location to receive count of function evaluations. |
|
grcount |
location to receive count of gradient evaluations. |
|
cfunc |
pointer to function used to calculate maximand. |
|
crittype |
code for type of the maximand/minimand: should
be |
|
gradfunc |
pointer to function used to calculate the
gradient, or |
|
data |
pointer that will be passed as the last
parameter to the callback functions |
|
A0 |
initial approximation to the inverse of the Hessian
(or |
|
opt |
may contain |
|
prn |
int LBFGS_max (double *b
,int n
,int maxit
,double reltol
,int *fncount
,int *grcount
,BFGS_CRIT_FUNC cfunc
,int crittype
,BFGS_GRAD_FUNC gradfunc
,BFGS_COMBO_FUNC combo_func
,void *data
,const gretl_matrix *bounds
,gretlopt opt
,PRN *prn
);
int newton_raphson_max (double *b
,int n
,int maxit
,double crittol
,double gradtol
,int *itercount
,int crittype
,BFGS_CRIT_FUNC cfunc
,BFGS_GRAD_FUNC gradfunc
,HESS_FUNC hessfunc
,void *data
,gretlopt opt
,PRN *prn
);
The functions cfunc
(computes the criterion, usually a
loglikelihood) and gradfunc
(score, provides an updated
estimate of the gradient in its second argument) are just as in
BFGS_max above.
The hessfunc
callback should compute the negative Hessian,
_not_ inverted; newton_raphson_max takes care of the inversion,
with a routine for fixing up the matrix if it's not positive
definite. If hessfunc
is NULL we fall back on a numerical
approximation to the Hessian.
b |
array of adjustable coefficients. |
|
n |
number elements in array |
|
maxit |
the maximum number of iterations to allow. |
|
crittol |
tolerance for terminating iteration, in terms of the change in the criterion. |
|
gradtol |
tolerance for terminating iteration, in terms of the gradient. |
|
itercount |
location to receive count of iterations. |
|
crittype |
code for type of the maximand/minimand: should
be |
|
cfunc |
pointer to function used to calculate maximand. |
|
gradfunc |
pointer to function used to calculate the
gradient, or |
|
hessfunc |
pointer to function used to calculate the Hessian. |
|
data |
pointer that will be passed as the last
parameter to the callback functions |
|
opt |
may contain |
|
prn |
int BFGS_numeric_gradient (double *b
,double *g
,int n
,BFGS_CRIT_FUNC func
,void *data
);
gretl_matrix * numerical_score_matrix (double *b
,int T
,int k
,BFGS_LLT_FUNC lltfun
,void *data
,int *err
);
int hessian_from_score (double *b
,gretl_matrix *H
,BFGS_GRAD_FUNC gradfunc
,BFGS_CRIT_FUNC cfunc
,void *data
);
Uses the score function (gradfunc
) is to construct a
numerical approximation to the Hessian. This is primarily
intended for building a covariance matrix at convergence;
note that it may not work well at an arbitrary point in
the parameter space.
Note that the only use of cfunc
within this function is
as an argument to be passed to gradfunc
. It is therefore
OK to pass NULL for cfunc
provided that gradfunc
does not
use its 4th argument, which corresponds to the BFGS_CRIT_FUNC
parameter.
gretl_matrix * hessian_inverse_from_score (double *b
,int n
,BFGS_GRAD_FUNC gradfunc
,BFGS_CRIT_FUNC cfunc
,void *data
,int *err
);
A wrapper for hessian_from_score()
which takes care of
(a) allocation of the Hessian and (b) inversion.
int numerical_hessian (double *b
,gretl_matrix *H
,BFGS_CRIT_FUNC func
,void *data
,int neg
,double d
);
gretl_matrix * numerical_hessian_inverse (const double *b
,int n
,BFGS_CRIT_FUNC func
,void *data
,double d
,int *err
);
A wrapper for numerical_hessian()
which takes care of
(a) allocation of the Hessian and (b) inversion.
double user_BFGS (gretl_matrix *b
,const char *fncall
,const char *gradcall
,DATASET *dset
,const gretl_matrix *bounds
,int minimize
,PRN *prn
,int *err
);
double user_NR (gretl_matrix *b
,const char *fncall
,const char *gradcall
,const char *hesscall
,DATASET *dset
,int minimize
,PRN *prn
,int *err
);
double deriv_free_optimize (MaxMethod method
,gretl_matrix *b
,const char *fncall
,int maxit
,double tol
,int minimize
,DATASET *dset
,PRN *prn
,int *err
);
gretl_matrix * user_fdjac (gretl_matrix *theta
,const char *fncall
,double eps
,DATASET *dset
,int *err
);
gretl_matrix * user_numhess (gretl_matrix *b
,const char *fncall
,double d
,DATASET *dset
,int *err
);
int gretl_simann (double *theta
,int n
,int maxit
,BFGS_CRIT_FUNC cfunc
,void *data
,gretlopt opt
,PRN *prn
);
Simulated annealing: can help to improve the initialization
of theta
for numerical optimization. On exit the value of
theta
is set to the func-best point in case of improvement,
otherwise to the last point visited.
theta |
parameter array. |
|
n |
length of |
|
maxit |
the maximum number of iterations to perform. |
|
cfunc |
the function to be maximized. |
|
data |
pointer to be passed to the |
|
opt |
may include |
|
prn |
printing struct, or NULL. |
int gretl_amoeba (double *theta
,int n
,int maxit
,BFGS_CRIT_FUNC cfunc
,void *data
,gretlopt opt
,PRN *prn
);
int gretl_fzero (double *bracket
,double tol
,ZFUNC zfunc
,void *data
,double *px
,gretlopt opt
,PRN *prn
);
int gretl_gss (double *theta
,double tol
,int *ic
,BFGS_CRIT_FUNC cfunc
,void *data
,gretlopt opt
,PRN *prn
);