Panel data

Panel data — estimation of panel data models

Functions

Includes

#include <libgretl.h>

Description

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

Functions

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);

Estimates a panel model, by default the fixed effects model.

Parameters

list

list containing model specification.

 

dset

dataset struct.

 

opt

may include OPT_U for the random effects model; OPT_R for robust standard errors (fixed effects model and pooled OLS only); OPT_M to use the matrix-difference version of the Hausman test (random effects only); OPT_B for the "between" model; OPT_P for pooled OLS; and OPT_D to include time dummies. If and only if OPT_P is given, OPT_C (clustered standard errors) is accepted. If OPT_U is given, either of the mutually incompatible options OPT_N and OPT_X may be given to inflect the calculation of the variance of the individual effects: OPT_N means use Nerlove's method, OPT_X means use the special "exact" method of Swamy and Arora in the case of an unbalanced panel. The default is to use the "generic" Swamy-Arora method.

 

prn

printing struct.

 

Returns

a MODEL struct, containing the estimates.


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.

Parameters

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,
                     DATASET *dset,
                     gretlopt opt,
                     PRN *prn);

panel_xdepend_test ()

int
panel_xdepend_test (MODEL *pmod,
                    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.

Parameters

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 , OPT_I for silent operation.

 

prn

for printing details of iterations (or NULL).

 

Returns

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


panel_DW_pval_ok ()

int
panel_DW_pval_ok (const MODEL *pmod);

BFN_panel_DW_pvalue ()

double
BFN_panel_DW_pvalue (MODEL *pmod,
                     const DATASET *dset,
                     int *err);

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.

Parameters

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_varnames ()

int
set_panel_structure_from_varnames (const char *uname,
                                   const char *tname,
                                   DATASET *dset);

set_panel_group_strings ()

int
set_panel_group_strings (const char *vname,
                         const char *grpnames,
                         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.

Parameters

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 .

Parameters

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 .

Parameters

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.

Parameters

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);

panel_padding_rows ()

int
panel_padding_rows (const DATASET *dset);

time_series_from_panel ()

int
time_series_from_panel (DATASET *tset,
                        const DATASET *pset);

obs_index_from_aqm ()

int
obs_index_from_aqm (const char *s,
                    int pd,
                    int t0,
                    int n);

usable_group_names_series_id ()

int
usable_group_names_series_id (const DATASET *dset,
                              int maxlen);