Top | ![]() |
![]() |
![]() |
![]() |
nlspec * | nlspec_new () |
void | nlspec_destroy () |
int | nlspec_add_param_with_deriv () |
int | nlspec_add_param_list () |
int | aux_nlspec_add_param_list () |
int | nlspec_set_regression_function () |
void | nlspec_set_t1_t2 () |
int | nl_parse_line () |
int | nl_set_smallstep () |
MODEL | nl_model () |
MODEL | model_from_nlspec () |
MODEL | GNR () |
int | finalize_nls_model () |
int | nls_boot_calc () |
int | nl_model_run_aux_genrs () |
double | get_default_nls_toler () |
Provides mechanisms for estimating nonlinear models via Nonlinear Least Squares, Maximum Likelihood, or GMM.
void
nlspec_destroy (nlspec *spec
);
Frees all resources associated with spec
, and frees the
pointer itself.
int nlspec_add_param_with_deriv (nlspec *spec
,const char *s
);
Adds an analytical derivative to spec
. This pointer must
have previously been obtained by a call to nlspec_new()
.
The required format for dstr
is "varname
= formula
", where
varname
is the name of the (scalar) variable holding the parameter
in question, and formula
is an expression, of the sort that
is fed to gretl's genr
command, giving the derivative of the
regression function in spec
with respect to the parameter.
The variable holding the parameter must be already present in
the dataset.
int nlspec_add_param_list (nlspec *spec
,int np
,double *vals
,char **names
);
Adds to spec
a list of (scalar) parameters to be estimated.
For an example of use see nls_example.c in the gretl extra
subdirectory.
int aux_nlspec_add_param_list (nlspec *spec
,int np
,double *vals
,char **names
);
int nlspec_set_regression_function (nlspec *spec
,const char *fnstr
,const DATASET *dset
);
Adds the regression function to spec
. This pointer must
have previously been obtained by a call to nlspec_new()
.
The required format for fnstr
is "varname
= formula
", where
varname
is the name of the dependent variable and formula
is an expression of the sort that is fed to gretl's genr
command.
The dependent variable must be already present in the
dataset.
void nlspec_set_t1_t2 (nlspec *spec
,int t1
,int t2
);
Sets the sample range for estimation of spec
. This pointer must
have previously been obtained by a call to nlspec_new()
.
int nl_parse_line (int ci
,const char *line
,const DATASET *dset
,PRN *prn
);
This function is used to create the specification of a nonlinear model, to be estimated via nl_model (i.e. via NLS, MLE or GMM). It can be called several times to build up the required information. See the manual entries for nls, mle and gmm for details.
MODEL nl_model (DATASET *dset
,gretlopt opt
,PRN *prn
);
Computes estimates of a model via nonlinear least squares, maximum likelihood, or GMM. The model must have been specified previously, via calls to the function nl_parse_line. Those calls determine, among other things, which estimator will be used.
MODEL model_from_nlspec (nlspec *spec
,DATASET *dset
,gretlopt opt
,PRN *prn
);
Computes estimates of the model specified in spec
.
The spec
must first be obtained using nlspec_new()
, and
initialized using nlspec_set_regression_function()
. If analytical
derivatives are to be used (which is optional but recommended)
these are set using nlspec_add_param_with_deriv()
.
int nls_boot_calc (const MODEL *pmod
,DATASET *dset
,int ft1
,int ft2
,double *fcerr
);