Limdep

Limdep — models for limited dependent variables and related cases.

Functions

Object Hierarchy


Includes

#include <libgretl.h>

Description

Covers logit (binary, ordered or multinomial), probit (binary or ordered), logistic, tobit, interval regression, models for count data and for duration data, and the heckit sample-selection model. Plus a few utility functions.

Functions

binary_logit ()

MODEL
binary_logit (const int *list,
              DATASET *dset,
              gretlopt opt,
              PRN *prn);

Computes estimates of the logit model specified by list , using Newton-Raphson.

Parameters

list

binary dependent variable plus list of regressors.

 

dset

dataset struct.

 

opt

if includes OPT_R form robust (QML) estimates of standard errors and covariance matrix; if OPT_P arrange for printing of p-values, not slopes at mean; if OPT_A treat as an auxiliary regression.

 

prn

printing struct in case additional information is wanted (in which case add OPT_V to opt ).

 

Returns

a MODEL struct, containing the estimates.


binary_probit ()

MODEL
binary_probit (const int *list,
               DATASET *dset,
               gretlopt opt,
               PRN *prn);

Computes estimates of the probit model specified by list , using Newton-Raphson.

Parameters

list

binary dependent variable plus list of regressors.

 

dset

dataset struct.

 

opt

if includes OPT_R form robust (QML) estimates of standard errors and covariance matrix; if OPT_P arrange for printing of p-values, not slopes at mean; if OPT_A treat as an auxiliary regression.

 

prn

printing struct in case additional information is wanted (in which case add OPT_V to opt ).

 

Returns

a MODEL struct, containing the estimates.


ordered_logit ()

MODEL
ordered_logit (int *list,
               DATASET *dset,
               gretlopt opt,
               PRN *prn);

Computes ML estimates of the ordered logit model specified by list .

Parameters

list

ordinal dependent variable plus list of regressors.

 

dset

dataset struct.

 

opt

if includes OPT_R form robust (QML) estimates of standard errors and covariance matrix; if includes OPT_V, produce verbose output.

 

prn

printing struct in case additional information is wanted (OPT_V).

 

Returns

a MODEL struct, containing the estimates.


ordered_probit ()

MODEL
ordered_probit (int *list,
                DATASET *dset,
                gretlopt opt,
                PRN *prn);

Computes ML estimates of the ordered probit model specified by list .

Parameters

list

ordinal dependent variable plus list of regressors.

 

dset

dataset struct.

 

opt

if includes OPT_R form robust (QML) estimates of standard errors and covariance matrix; if includes OPT_V, produce verbose output.

 

prn

printing struct in case additional information is wanted (OPT_V).

 

Returns

a MODEL struct, containing the estimates.


multinomial_logit ()

MODEL
multinomial_logit (int *list,
                   DATASET *dset,
                   gretlopt opt,
                   PRN *prn);

Computes ML estimates of the multinomial model specified by list .

Parameters

list

discrete dependent variable plus list of regressors.

 

dset

dataset struct.

 

opt

if includes OPT_R form robust (QML) estimates of standard errors and covariance matrix; if includes OPT_V, produce verbose output.

 

prn

printing struct in case additional information is wanted (OPT_V).

 

Returns

a MODEL struct, containing the estimates.


biprobit_model ()

MODEL
biprobit_model (int *list,
                DATASET *dset,
                gretlopt opt,
                PRN *prn);

Computes estimates of the bivariate probit model specified by list , using maximum likelihood via Newton-Raphson.

Parameters

list

binary dependent variable 1, binary dependent variable 2, list of regressors for y1. If list ends here, it is assumed that the explanatory variables for y2 are the same as y1. Otherwise, the list must include a separator and the list of regressors for y2.

 

dset

dataset struct.

 

opt

can contain OPT_Q for quiet operation, OPT_V for verbose operation, OPT_R for robust covariance matrix, OPT_G for covariance matrix based on Outer Product of Gradient.

 

prn

printing struct.

 

Returns

a MODEL struct, containing the estimates.


reprobit_model ()

MODEL
reprobit_model (const int *list,
                DATASET *dset,
                gretlopt opt,
                PRN *prn);

Produce random-effects probit estimates of the model given in list .

Parameters

list

dependent variable plus list of regressors.

 

dset

dataset struct.

 

opt

option flags (may include OPT_V for verbose output).

 

prn

printing struct for iteration info (or NULL if this is not wanted).

 

Returns

a MODEL struct, containing the estimates.


logistic_model ()

MODEL
logistic_model (const int *list,
                double lmax,
                DATASET *dset);

Estimate the model given in list using the logistic transformation of the dependent variable.

Parameters

list

dependent variable plus list of regressors.

 

lmax

value for the asymptote of the logistic curve, or NADBL for automatic treatment of this.

 

dset

dataset struct.

 

Returns

a MODEL struct, containing the estimates.


interval_model ()

MODEL
interval_model (int *list,
                DATASET *dset,
                gretlopt opt,
                PRN *prn);

Parameters

list

high/low (2 variables) plus list of regressors.

 

dset

dataset struct.

 

opt

if includes OPT_R form robust (QML) estimates of standard errors and covariance matrix; if includes OPT_V give verbose operation.

 

prn

printing struct in case additional information is wanted (signalled via OPT_V).

 

Returns

a MODEL struct, containing interval estimates of the model specified by list .


tobit_model ()

MODEL
tobit_model (const int *list,
             double llim,
             double rlim,
             DATASET *dset,
             gretlopt opt,
             PRN *prn);

Produce Tobit estimates of the model given in list .

Parameters

list

dependent variable plus list of regressors.

 

llim

left bound on dependent variable; use NADBL for no left-censoring.

 

rlim

right bound on dependent variable; use NADBL for no right-censoring.

 

dset

dataset struct.

 

opt

may include OPT_V for verbose operation, OPT_R for robust (QML) standard errors.

 

prn

printing struct for iteration info (or NULL if this is not wanted).

 

Returns

a MODEL struct, containing the estimates.


duration_model ()

MODEL
duration_model (const int *list,
                DATASET *dset,
                gretlopt opt,
                PRN *prn);

Estimate the duration model given in list using ML.

Parameters

list

dependent variable plus list of regressors.

 

dset

dataset struct.

 

opt

may include OPT_R for robust covariance matrix.

 

prn

printing struct for iteration info (or NULL is this is not wanted).

 

Returns

a MODEL struct, containing the estimates.


count_model ()

MODEL
count_model (const int *list,
             int ci,
             DATASET *dset,
             gretlopt opt,
             PRN *prn);

Estimate the count data model given in list using ML.

Parameters

list

dependent variable plus list of regressors.

 

ci

either POISSON or NEGBIN.

 

dset

dataset struct.

 

opt

may include OPT_R for robust covariance matrix.

 

prn

printing struct for iteration info (or NULL is this is not wanted).

 

Returns

a MODEL struct, containing the estimates.


heckit_model ()

MODEL
heckit_model (const int *list,
              DATASET *dset,
              gretlopt opt,
              PRN *prn);

Produce Heckit estimates of the model given in list . The list must include a separator to divide the main equation from the selection equation.

Parameters

list

dependent variable plus list of regressors.

 

dset

dataset struct.

 

opt

option flags (may include OPT_V for verbose output).

 

prn

printing struct for iteration info (or NULL is this is not wanted).

 

Returns

a MODEL struct, containing the estimates.


fishers_exact_test ()

int
fishers_exact_test (const Xtab *tab,
                    PRN *prn);

Computes and prints to prn the p-value for Fisher's Exact Test for association between the two variables represented in tab .

Parameters

tab

pointer to 2 x 2 cross-tabulation struct.

 

prn

gretl printer.

 

Returns

0 on successful completion, error code on error.


ordered_model_prediction ()

double
ordered_model_prediction (const MODEL *pmod,
                          double Xb);

Parameters

pmod

model for ordered data, either logit or probit.

 

Xb

X\beta, the value of the index function at a given observation.

 

Returns

the predicted value of the (ordinal) dependent variable; that is, the value for which the estimated probability is greatest.


logistic_ymax_lmax ()

int
logistic_ymax_lmax (const double *y,
                    const DATASET *dset,
                    double *ymax,
                    double *lmax);

Checks that the non-missing values of y are all positive, and if so writes the maximum value of y to ymax . The value written to lmax is 1 if max(y) < 1, else 100 if max(y) < 100, else 1.1 * max(y).

Parameters

y

data series.

 

dset

dataset information.

 

ymax

location to receive max(y).

 

lmax

location to receive a guess at a suitable asymptote for a logistic curve fitted to y .

 

Returns

0 on success, non-zero on error.


mn_logit_probabilities ()

gretl_matrix *
mn_logit_probabilities (const MODEL *pmod,
                        const DATASET *dset,
                        int *err);

Computes the estimated probabilities of the outcomes for a multinomial logit model. The returned matrix is n x m, where n is the number of observations in the sample range over which the model was estimated and m is the number of distinct outcomes. Each element represents the conditional probability of outcome j given the values of the regressors at observation i.

If any of the regressor values are missing at a given observation the probabiity is set to NaN; provided the regressor information is complete we compute the outcome probabilities even if the actual outcome is missing.

Parameters

pmod

pointer to multinomial logit model

 

dset

dataset struct.

 

err

location to receive error code.

 

Returns

allocated matrix or NULL on failure.


mn_logit_prediction ()

double
mn_logit_prediction (const gretl_matrix *Xt,
                     const double *b,
                     const gretl_matrix *yvals);

Parameters

Xt

vector of regressors at observation t.

 

b

array of coefficients.

 

yvals

vector of dependent variable values.

 

Returns

the predicted value of the dependent variable, that is, the value for which the estimated probability is greatest.


binary_model_hatvars ()

void
binary_model_hatvars (MODEL *pmod,
                      const gretl_matrix *ndx,
                      const int *y,
                      gretlopt opt);

Types and Values