| Libgretl Reference Manual |
|---|
estimateestimate — |
MODEL lsq (const int *list, double ***pZ, DATAINFO *pdinfo, GretlCmdIndex ci, gretlopt opt); MODEL ar1_lsq (const int *list, double ***pZ, DATAINFO *pdinfo, GretlCmdIndex ci, gretlopt opt, double rho); double estimate_rho (const int *list, double ***pZ, DATAINFO *pdinfo, GretlCmdIndex ci, int *err, gretlopt opt, PRN *prn); MODEL lad (const int *list, double ***pZ, DATAINFO *pdinfo); MODEL arma (const int *list, const double **Z, const DATAINFO *pdinfo, gretlopt opt, PRN *prn); MODEL tobit_model (const int *list, double ***pZ, DATAINFO *pdinfo, PRN *prn); MODEL poisson_model (const int *list, double ***pZ, DATAINFO *pdinfo, PRN *prn); MODEL garch (const int *list, double ***pZ, DATAINFO *pdinfo, gretlopt opt, PRN *prn); MODEL mp_ols (const int *list, const double **Z, DATAINFO *pdinfo); MODEL panel_model (const int *list, double ***pZ, DATAINFO *pdinfo, gretlopt opt, PRN *prn); MODEL arbond_model (const int *list, const char *istr, const double **Z, const DATAINFO *pdinfo, gretlopt opt, PRN *prn); int groupwise_hetero_test (const MODEL *pmod, double ***pZ, DATAINFO *pdinfo, PRN *prn); MODEL hsk_func (const int *list, double ***pZ, DATAINFO *pdinfo); int whites_test (MODEL *pmod, double ***pZ, DATAINFO *pdinfo, gretlopt opt, PRN *prn); MODEL ar_func (const int *list, double ***pZ, DATAINFO *pdinfo, gretlopt opt, PRN *prn); int arch_test (MODEL *pmod, int order, const DATAINFO *pdinfo, gretlopt opt, PRN *prn); MODEL arch_model (const int *list, int order, double ***pZ, DATAINFO *pdinfo, gretlopt opt, PRN *prn); int makevcv (MODEL *pmod, double sigma); int* augment_regression_list (const int *orig, int aux, double ***pZ, DATAINFO *pdinfo); int gretl_XTX_XTy (const int *list, int t1, int t2, const double **Z, int nwt, double rho, int pwe, double *xpx, double *xpy, const char *mask);
MODEL lsq (const int *list, double ***pZ, DATAINFO *pdinfo, GretlCmdIndex ci, gretlopt opt);
Computes least squares estimates of the model specified by list,
using an estimator determined by the value of ci.
list : |
dependent variable plus list of regressors. |
pZ : |
pointer to data matrix. |
pdinfo : |
information on the data set. |
ci : |
one of the command indices in LSQ_MODEL. |
opt : |
option flags: zero or more of the following --
OPT_R compute robust standard errors;
OPT_A treat as auxiliary regression (don't bother checking
for presence of lagged dependent var, don't augment model count);
OPT_P use Prais-Winsten for first obs;
OPT_N don't use degrees of freedom correction for standard
error of regression;
OPT_M reject missing observations within sample range;
OPT_Z (internal use) suppress the automatic elimination of
perfectly collinear variables.
OPT_X: compute "variance matrix" as just (X'X)^{-1}
|
| Returns : | a MODEL struct, containing the estimates. |
MODEL ar1_lsq (const int *list, double ***pZ, DATAINFO *pdinfo, GretlCmdIndex ci, gretlopt opt, double rho);
list : |
|
pZ : |
|
pdinfo : |
|
ci : |
|
opt : |
|
rho : |
|
| Returns : |
double estimate_rho (const int *list,
double ***pZ,
DATAINFO *pdinfo,
GretlCmdIndex ci,
int *err,
gretlopt opt,
PRN *prn);
Estimate the quasi-differencing coefficient for use with the Cochrane-Orcutt, Hildreth-Lu or Prais-Winsten procedures for handling first-order serial correlation. Print a trace of the search for rho.
list : |
dependent variable plus list of regressors. |
pZ : |
pointer to data matrix. |
pdinfo : |
information on the data set. |
ci : |
CORC for Cochrane-Orcutt, HILU for Hildreth-Lu,
PWE for Prais-Winsten estimator.
|
err : |
pointer for error code. |
opt : |
option flags: may include OPT_B to suppress Cochrane-Orcutt
fine-tuning of Hildreth-Lu results, OPT_P to generate
a gnuplot graph of the search in case ci = HILU.
|
prn : |
gretl printing struct. |
| Returns : | rho estimate on successful completion, NADBL on error. |
MODEL lad (const int *list, double ***pZ, DATAINFO *pdinfo);
Estimate the model given in list using the method of Least
Absolute Deviation (LAD).
list : |
dependent variable plus list of regressors. |
pZ : |
pointer to data array. |
pdinfo : |
information on the data set. |
| Returns : | a MODEL struct, containing the estimates. |
MODEL arma (const int *list, const double **Z, const DATAINFO *pdinfo, gretlopt opt, PRN *prn);
Calculate ARMA estimates, using either native gretl code or by invoking X-12-ARIMA.
list : |
dependent variable, AR and MA orders, and any exogenous regressors. |
Z : |
data array. |
pdinfo : |
information on the data set. |
opt : |
options: may include OPT_S to suppress intercept, OPT_V
for verbose results, OPT_X to use X-12-ARIMA, OPT_C to put
X-12-ARIMA into conditional maximum-likelihood mode.
|
prn : |
for printing details of iterations (or NULL).
|
| Returns : | a MODEL struct, containing the estimates. |
MODEL tobit_model (const int *list, double ***pZ, DATAINFO *pdinfo, PRN *prn);
Produce Tobit estimates of the model given in list.
list : |
dependent variable plus list of regressors. |
pZ : |
pointer to data array. |
pdinfo : |
information on the data set. |
prn : |
printing struct for iteration info (or NULL is this is not
wanted).
|
| Returns : | a MODEL struct, containing the estimates. |
MODEL poisson_model (const int *list, double ***pZ, DATAINFO *pdinfo, PRN *prn);
Estimate the Poisson regression model given in list using ML.
list : |
dependent variable plus list of regressors. |
pZ : |
pointer to data matrix. |
pdinfo : |
information on the data set. |
prn : |
printing struct for iteration info (or NULL is this is not
wanted).
|
| Returns : | a MODEL struct, containing the estimates. |
MODEL garch (const int *list, double ***pZ, DATAINFO *pdinfo, gretlopt opt, PRN *prn);
Calculate GARCH estimates.
list : |
dependent variable plus arch and garch orders. |
pZ : |
pointer to data array. |
pdinfo : |
information on the data set. |
opt : |
can specify robust standard errors and VCV. |
prn : |
for printing details of iterations (or NULL).
|
| Returns : | a MODEL struct, containing the estimates. |
MODEL mp_ols (const int *list, const double **Z, DATAINFO *pdinfo);
Estimate an OLS model using multiple-precision arithmetic via the GMP library.
list : |
specification of variables to use. |
Z : |
data array. |
pdinfo : |
information on the data set. |
| Returns : | a MODEL struct, containing the estimates. |
MODEL panel_model (const int *list, double ***pZ, DATAINFO *pdinfo, gretlopt opt, PRN *prn);
Calculate estimates for a panel dataset, using fixed effects (the default), random effects, or weighted least squares based on the respective variances for the cross-sectional units.
list : |
regression list (dependent variable plus independent variables). |
pZ : |
pointer to data matrix. |
pdinfo : |
information on the (panel) data set. |
opt : |
can include OPT_Q (quiet estimation), OPT_S
(silent estimation), OPT_R (random effects model),
OPT_W (weights based on the error variance for the
respective cross-sectional units), OPT_T (iterate, only
available in conjunction with OPT_W).
|
prn : |
printing struct (or NULL).
|
| Returns : | a MODEL struct, containing the estimates. |
MODEL arbond_model (const int *list, const char *istr, const double **Z, const DATAINFO *pdinfo, gretlopt opt, PRN *prn);
To be written. This function is currently just for testing.
list : |
regression list. |
istr : |
may contain additional instrument specification. |
Z : |
data array. |
pdinfo : |
information on the (panel) data set. |
opt : |
to be hooked up. |
prn : |
printing struct (or NULL).
|
| Returns : | a MODEL struct, containing the estimates. |
int groupwise_hetero_test (const MODEL *pmod, double ***pZ, DATAINFO *pdinfo, PRN *prn);
Calculates iterated WLS estimates using weights based on the error variance for the cross-sectional units and performs a Wald test for the null hypothesis that the error variance is uniform across the units.
pmod : |
pooled OLS model to be tested. |
pZ : |
pointer to data array. |
pdinfo : |
information on the (panel) data set. |
prn : |
for printing details of iterations (or NULL).
|
| Returns : | 0 on success, non-zero error code on failure. |
MODEL hsk_func (const int *list, double ***pZ, DATAINFO *pdinfo);
Estimate the model given in list using a correction for
heteroskedasticity.
list : |
dependent variable plus list of regressors. |
pZ : |
pointer to data array. |
pdinfo : |
information on the data set. |
| Returns : | a MODEL struct, containing the estimates. |
int whites_test (MODEL *pmod, double ***pZ, DATAINFO *pdinfo, gretlopt opt, PRN *prn);
Runs White's test for heteroskedasticity on the given model.
pmod : |
pointer to model. |
pZ : |
pointer to data matrix. |
pdinfo : |
information on the data set. |
opt : |
if flags include OPT_S, save results to model; OPT_Q
means don't print the auxiliary regression.
|
prn : |
gretl printing struct. |
| Returns : | 0 on successful completion, error code on error. |
MODEL ar_func (const int *list, double ***pZ, DATAINFO *pdinfo, gretlopt opt, PRN *prn);
Estimate the model given in list using the generalized
Cochrane-Orcutt procedure for autoregressive errors.
list : |
list of lags plus dependent variable and list of regressors. |
pZ : |
pointer to data matrix. |
pdinfo : |
information on the data set. |
opt : |
may contain OPT_O to print covariance matrix. |
prn : |
gretl printing struct. |
| Returns : | MODEL struct containing the results. |
int arch_test (MODEL *pmod, int order, const DATAINFO *pdinfo, gretlopt opt, PRN *prn);
Tests pmod for AutoRegressive Conditional Heteroskedasticity.
pmod : |
model to be tested. |
order : |
lag order for ARCH process. |
pdinfo : |
information on the data set. |
opt : |
if flags include OPT_S, save test results to model;
if OPT_Q, be less verbose.
|
prn : |
gretl printing struct. |
| Returns : | 0 on success, non-zero code on error. |
MODEL arch_model (const int *list, int order, double ***pZ, DATAINFO *pdinfo, gretlopt opt, PRN *prn);
Estimate the model given in list via weighted least squares,
with the weights based on the predicted error variances from
an auxiliary regression of the squared residuals on their lagged
values.
list : |
dependent variable plus list of regressors. |
order : |
lag order for ARCH process. |
pZ : |
pointer to data matrix. |
pdinfo : |
information on the data set. |
opt : |
may contain OPT_O to print covariance matrix. |
prn : |
gretl printing struct. |
| Returns : | a MODEL struct, containing the estimates. |
int makevcv (MODEL *pmod, double sigma);
Inverts the Cholesky-decomposed X'X matrix and computes the coefficient covariance matrix.
pmod : |
pointer to model. |
sigma : |
square root of error variance, or 1.0 to produce just X'X^{-1}. |
| Returns : | 0 on successful completion, non-zero code on error. |
int* augment_regression_list (const int *orig,
int aux,
double ***pZ,
DATAINFO *pdinfo);
Augment the regression list orig with auxiliary terms. If aux
is AUX_SQ add the squares of the original regressors; if aux
is AUX_WHITE add squares and cross-products, or if aux is
AUX_LOG add the natural logs of the original regressors.
If they are not already present, these variables are added
to the data array.
orig : |
list giving original regression specification. |
aux : |
either AUX_SQ, AUX_LOG or AUX_WHITE.
|
pZ : |
pointer to data array. |
pdinfo : |
information on the data set. |
| Returns : | the augmented list, or NULL on failure. |
int gretl_XTX_XTy (const int *list,
int t1,
int t2,
const double **Z,
int nwt,
double rho,
int pwe,
double *xpx,
double *xpy,
const char *mask);
Calculates X'X and X'y, with various possible transformations
of the original data, depending on nwt, rho and pwe.
xpy[0] holds the sum of y (that is, Z[list[1]]) and xpy[list[0]]
holds y'y. If X'y is not required, xpy can be given as NULL.
list : |
list of variables in model. |
t1 : |
starting observation. |
t2 : |
ending observation. |
Z : |
data array. |
nwt : |
ID number of variable used as weight. |
rho : |
quasi-differencing coefficent. |
pwe : |
if non-zero, use Prais-Winsten for first observation. |
xpx : |
on output, X'X matrix as lower triangle, stacked by columns. |
xpy : |
on output, X'y vector (but see below). |
mask : |
missing observations mask, or NULL.
|
| Returns : | 0 on success, non-zero on error. |
| << Estimation and forecasting | discrete >> |