Panel data

Panel data — estimation of panel data models

Synopsis

#include <libgretl.h>

int                 panel_diagnostics                   (MODEL *pmod,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);
MODEL               real_panel_model                    (const int *list,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);
MODEL               panel_wls_by_unit                   (const int *list,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);
int                 panel_autocorr_test                 (MODEL *pmod,
                                                         int order,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);
int                 groupwise_hetero_test               (MODEL *pmod,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);
int                 panel_tsls_robust_vcv               (MODEL *pmod,
                                                         const DATASET *dset);
int                 set_panel_structure_from_vars       (int uv,
                                                         int tv,
                                                         DATASET *dset);
int                 set_panel_structure_from_line       (const char *line,
                                                         DATASET *dset);
int                 set_panel_group_strings             (const char *line,
                                                         DATASET *dset);
int                 switch_panel_orientation            (DATASET *dset);
int                 balanced_panel                      (const DATASET *dset);
int                 undo_panel_padding                  (DATASET *dset);
int *               panel_list_omit                     (const MODEL *orig,
                                                         const int *drop,
                                                         int *err);
int *               panel_list_add                      (const MODEL *orig,
                                                         const int *add,
                                                         int *err);
int                 panel_variance_info                 (const double *x,
                                                         const DATASET *dset,
                                                         double xbar,
                                                         double *psw,
                                                         double *psb);
int                 plausible_panel_time_var            (const DATASET *dset);
int                 panel_isconst                       (int t1,
                                                         int t2,
                                                         int pd,
                                                         const double *x,
                                                         int bygroup);
int                 series_is_group_invariant           (const DATASET *dset,
                                                         int v);

Description

Provides support for estimating panel data models such as fixed and random effects.

Details

panel_diagnostics ()

int                 panel_diagnostics                   (MODEL *pmod,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);


real_panel_model ()

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


panel_wls_by_unit ()

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

Performs weighted least squares (possibly iterated) on a panel model, allowing for groupwise heteroskedasticity.

list :

regression list.

dset :

dataset struct.

opt :

may include OPT_I (iterate to ML solution), OPT_V for verbose operation.

prn :

for printing details of iterations (or NULL).

Returns :

the estimates, in a MODEL.

panel_autocorr_test ()

int                 panel_autocorr_test                 (MODEL *pmod,
                                                         int order,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);


groupwise_hetero_test ()

int                 groupwise_hetero_test               (MODEL *pmod,
                                                         DATASET *dset,
                                                         gretlopt opt,
                                                         PRN *prn);

Performs a Wald test for the null hypothesis that the error variance is uniform across the units.

pmod :

panel model to be tested.

dset :

information on the (panel) data set.

opt :

may contain OPT_S to attach the test result to pmod.

prn :

for printing details of iterations (or NULL).

Returns :

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

panel_tsls_robust_vcv ()

int                 panel_tsls_robust_vcv               (MODEL *pmod,
                                                         const DATASET *dset);


set_panel_structure_from_vars ()

int                 set_panel_structure_from_vars       (int uv,
                                                         int tv,
                                                         DATASET *dset);

Sets the panel structure of dset based on the information in the series with indices uv and tv, if possible.

uv :

index of series uniquely identifying units/groups.

tv :

index of series uniquely identifying time periods.

dset :

pointer to dataset.

Returns :

0 on success, non-zero code on error.

set_panel_structure_from_line ()

int                 set_panel_structure_from_line       (const char *line,
                                                         DATASET *dset);


set_panel_group_strings ()

int                 set_panel_group_strings             (const char *line,
                                                         DATASET *dset);


switch_panel_orientation ()

int                 switch_panel_orientation            (DATASET *dset);

Reorganizes dset, transforming from stacked cross sections to stacked time series or vice versa. If the transformation is from stacked time series to stacked cross section, the dataset will no longer be acceptable as a panel for gretl's purposes; it may be useful for export purposes, though.

dset :

pointer to dataset struct.

Returns :

0 on successful completion, non-zero on error.

balanced_panel ()

int                 balanced_panel                      (const DATASET *dset);


undo_panel_padding ()

int                 undo_panel_padding                  (DATASET *dset);


panel_list_omit ()

int *               panel_list_omit                     (const MODEL *orig,
                                                         const int *drop,
                                                         int *err);

Creates a new panel regression list, by first reconstructing the regression specification from orig then deleting from the reconstruction the variables found in drop.

orig :

list specifying original panel model.

drop :

list of variables to be omitted.

err :

pointer to receive error code.

Returns :

the new, reduced list or NULL on error.

panel_list_add ()

int *               panel_list_add                      (const MODEL *orig,
                                                         const int *add,
                                                         int *err);

Creates a new panel regression list, by first reconstructing the regression specification from orig then adding to the reconstruction the variables found in add.

orig :

list specifying original panel model.

add :

list of variables to be added.

err :

pointer to receive error code.

Returns :

the new, augmented list or NULL on error.

panel_variance_info ()

int                 panel_variance_info                 (const double *x,
                                                         const DATASET *dset,
                                                         double xbar,
                                                         double *psw,
                                                         double *psb);


plausible_panel_time_var ()

int                 plausible_panel_time_var            (const DATASET *dset);


panel_isconst ()

int                 panel_isconst                       (int t1,
                                                         int t2,
                                                         int pd,
                                                         const double *x,
                                                         int bygroup);

Check whether series x is constant (either over time or across groups) in a panel dataset. Missing values are ignored.

t1 :

starting observation.

t2 :

ending observation.

pd :

panel time-series length.

x :

data series to examine.

bygroup :

use 1 to check for constancy across groups, 0 for constancy across time.

Returns :

1 if the variable is constant, otherwise 0.

series_is_group_invariant ()

int                 series_is_group_invariant           (const DATASET *dset,
                                                         int v);