tsls

tsls

Functions

void tsls_free_data ()
int ivreg_process_lists ()
int * ivreg_list_omit ()
int * ivreg_list_add ()
int * tsls_make_endolist ()
MODEL tsls ()

Description

Functions

tsls_free_data ()

void
tsls_free_data (const MODEL *pmod);

Frees the first-stage data attached to a two-stage least squares model that was estimated using OPT_E (part of a system).

Parameters

pmod

model to operate on.

 

ivreg_process_lists ()

int
ivreg_process_lists (const int *list,
                     int **reglist,
                     int **instlist);

Split the incoming list into its two components and perform some basic checks; if the checks fail the two created lists are destroyed.

Parameters

list

original specification list.

 

reglist

location to receive regression list.

 

instlist

location to receive list of instruments.

 

Returns

0, on success, non-zero error code on failure.


ivreg_list_omit ()

int *
ivreg_list_omit (const int *orig,
                 const int *drop,
                 gretlopt opt,
                 int *err);

Creates a new IVREG specification list, by first copying orig then deleting from the copy the variables found in drop .

Parameters

orig

list specifying original IV model.

 

drop

list of variables to be omitted.

 

opt

may include OPT_T (omit variable only as instrument) or OPT_B (omit both as regressor and instrument). The default is to omit (only) as regressor.

 

err

pointer to receive error code.

 

Returns

the new, reduced list or NULL on error.


ivreg_list_add ()

int *
ivreg_list_add (const int *orig,
                const int *add,
                gretlopt opt,
                int *err);

Creates a new IVREG specification list, by copying orig and adding the variables found in add .

Parameters

orig

list specifying original IV model.

 

add

list of variables to be added.

 

opt

may include OPT_T (add variable only as instrument) or OPT_B (add both as regressor and instrument). The default is to add as an endogenous regressor.

 

err

pointer to receive error code.

 

Returns

the new, augmented list or NULL on error.


tsls_make_endolist ()

int *
tsls_make_endolist (const int *reglist,
                    int **instlist,
                    int *addconst,
                    int *err);

Determines which variables in reglist , when checked against the predetermined and exogenous vars in instlist , need to be instrumented, and populates the returned list accordingly.

If addconst is non-NULL and the constant is found in reglist but not in instlist , then it is added to instlist and this is flagged by writing 1 into addconst .

Parameters

reglist

regression specification.

 

instlist

predetermined and exogenous variables.

 

addconst

location to receive notification of whether the constant was added to the content of instlist , or NULL.

 

err

location to receive error code.

 

Returns

allocated list of variables to be instrumented or NULL if there are no such variables.


tsls ()

MODEL
tsls (const int *list,
      DATASET *dset,
      gretlopt opt);

Estimate the model given in list by means of Two-Stage Least Squares. If OPT_E is given, fitted values from the first-stage regressions are saved with the model.

Parameters

list

dependent variable plus list of regressors.

 

dset

dataset struct.

 

opt

may contain OPT_R for robust VCV, OPT_N for no df correction, OPT_A if this is an auxiliary reression, OPT_E if we're estimating one equation within a system, OPT_H to add "hatlist" to model even under OPT_E, OPT_X to skip the set of tests that are usually calculated. Also OPT_C for clustered standard errors.

 

Returns

a MODEL struct, containing the estimates.

Types and Values