Model tests

Model tests — diagnostic and specification tests for models

Functions

double wald_omit_F ()
double wald_omit_chisq ()
int add_test ()
int add_test_full ()
int omit_test ()
int omit_test_full ()
int nonlinearity_test ()
int reset_test ()
int autocorr_test ()
int comfac_test ()
double get_DW_pvalue_for_model ()
int chow_test ()
int chow_test_from_dummy ()
int QLR_test ()
int cusum_test ()
int panel_hausman_test ()
int vif_test ()
int leverage_test ()
int add_leverage_values_to_dataset ()
void print_add_omit_null ()

Types and Values

Object Hierarchy


Includes

#include <libgretl.h>

Description

Included here are several tests for "pathologies" of the error term in regression models, as well as specification tests covering nonlinearity and the omission or addition of variables.

Functions

wald_omit_F ()

double
wald_omit_F (const int *list,
             MODEL *pmod);

Simple form of Wald F-test for omission of variables. If list is non-NULL, do the test for the omission of the variables in list from the model pmod . Otherwise test for omission of all variables in pmod except for the constant.

Parameters

list

list of variables to omit, or NULL.

 

pmod

model to be tested.

 

Returns

Calculated F-value, or NADBL on failure.


wald_omit_chisq ()

double
wald_omit_chisq (const int *list,
                 MODEL *pmod);

Simple form of Wald chi-square for omission of variables. If list is non-NULL, do the test for the omission of the variables in list from the model pmod . Otherwise test for omission of all variables in pmod except for the constant.

Parameters

list

list of variables to omit, or NULL.

 

pmod

model to be tested.

 

Returns

Calculated chi-square value, or NADBL on failure.


add_test ()

int
add_test (MODEL *pmod,
          const int *addvars,
          DATASET *dset,
          gretlopt opt,
          PRN *prn);

Performs an LM test on pmod for the null hypothesis that the addvars variables do not contribute significant explanatory power.

Parameters

pmod

pointer to model to be tested.

 

addvars

list of variables to test.

 

dset

dataset struct.

 

opt

can contain OPT_Q (quiet) to suppress printing of the auxiliary model, OPT_I to suppress all printing of results.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


add_test_full ()

int
add_test_full (MODEL *orig,
               MODEL *pmod,
               const int *addvars,
               DATASET *dset,
               gretlopt opt,
               PRN *prn);

Re-estimate a given model after adding the specified variables, and records a joint test on the additional variables.

Parameters

orig

pointer to original model.

 

pmod

pointer to receive augmented model.

 

addvars

list of variables to add to original model.

 

dset

dataset struct.

 

opt

can contain OPT_Q (quiet) to suppress printing of the new model, OPT_O to print its covariance matrix, OPT_I for silent operation.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


omit_test ()

int
omit_test (MODEL *pmod,
           const int *omitvars,
           DATASET *dset,
           gretlopt opt,
           PRN *prn);

Performs a Wald test on pmod for the null hypothesis that the omitvars variables do not contribute explanatory power.

Parameters

pmod

pointer to model to be tested.

 

omitvars

list of variables to test.

 

dset

dataset struct.

 

opt

can contain OPT_Q (quiet) to suppress printing of results.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


omit_test_full ()

int
omit_test_full (MODEL *orig,
                MODEL *pmod,
                const int *omitvars,
                DATASET *dset,
                gretlopt opt,
                PRN *prn);

Re-estimate a given model after removing the variables specified in omitvars . Or if OPT_A is given, proceed sequentially, at each step dropping the least significant variable provided its p-value is above a certain threshold (currently 0.10, two-sided).

Parameters

orig

pointer to original model.

 

pmod

pointer to receive new model, with vars omitted.

 

omitvars

list of variables to omit from original model.

 

dset

dataset struct.

 

opt

can contain OPT_Q (quiet) to suppress printing of the new model, OPT_O to print its covariance matrix, OPT_I for silent operation; for OPT_A, see below.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


nonlinearity_test ()

int
nonlinearity_test (MODEL *pmod,
                   DATASET *dset,
                   ModelAuxCode aux,
                   gretlopt opt,
                   PRN *prn);

Run an auxiliary regression to test pmod for nonlinearity, via the addition of either squares or logs of the original indepdendent variables.

Parameters

pmod

pointer to original model.

 

dset

dataset struct.

 

aux

AUX_SQ for squares or AUX_LOG for logs

 

opt

if contains OPT_S, save test results to model.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


reset_test ()

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

Carries out and prints Ramsey's RESET test for model specification.

Parameters

pmod

pointer to model to be tested.

 

dset

dataset struct.

 

opt

if contains OPT_S, save test results to model. OPT_Q suppresses the printout of the auxiliary regression. OPT_R and OPT_C stand for "squares only" and "cubes only", respectively.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


autocorr_test ()

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

Tests the given model for autocorrelation of order equal to the specified value, or equal to the frequency of the data if the supplied order is zero. Prints TR^2 and LMF test statistics.

Parameters

pmod

pointer to model to be tested.

 

order

lag order for test.

 

dset

dataset struct.

 

opt

if flags include OPT_S, save test results to model; if OPT_Q, be less verbose.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


comfac_test ()

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

If pmod was estimated via an AR(1) estimator, run an auxiliary regression to test the implied common-factor restriction.

Parameters

pmod

pointer to original model.

 

dset

dataset struct.

 

opt

if contains OPT_S, save test results to model.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


get_DW_pvalue_for_model ()

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

Computes the p-value for the Durbin-Watson statistic for the given model, using the Imhof method.

Parameters

pmod

model to be tested.

 

dset

dataset struct.

 

err

location to receive error code.

 

Returns

the p-value, or NADBL on error.


chow_test ()

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

Tests the given model for structural stability (Chow test) using the sample break-point given by splitobs and prints the results to prn . (The second portion of the sample runs from observation splitobs to the end of the original sample range.)

Parameters

splitobs

the 0-based observation number at which to split the sample.

 

pmod

pointer to model to be tested.

 

dset

dataset struct.

 

opt

if flags include OPT_S, save test results to model.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


chow_test_from_dummy ()

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

Tests the given model for structural stability (Chow test), using the dummy variable specified by splitvar to divide the original sample range of pmod into two portions.

Parameters

splitvar

the ID number of a dummy variable that should be used to divide the sample.

 

pmod

pointer to model to be tested.

 

dset

dataset struct.

 

opt

if flags include OPT_S, save test results to model.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


QLR_test ()

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

Tests the given model for structural stability via the Quandt Likelihood Ratio test for a structural break at an unknown point in the sample range.

Parameters

pmod

pointer to model to be tested.

 

dset

dataset struct.

 

opt

if flags include OPT_S, save test results to model.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


cusum_test ()

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

Tests the given model for parameter stability via the CUSUM test, or if opt includes OPT_R, via the CUSUMSQ test; OPT_Q makes the test quiet.

Parameters

pmod

pointer to model to be tested.

 

dset

dataset struct.

 

opt

if flags include OPT_S, save results of test to model.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


panel_hausman_test ()

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

Tests the given pooled model for fixed and random effects.

Parameters

pmod

pointer to model to be tested.

 

dset

dataset struct.

 

opt

option flags.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


vif_test ()

int
vif_test (MODEL *pmod,
          DATASET *dset,
          PRN *prn);

Calculates and displays the Variance Inflation Factors for the independent variables in the given model.

Parameters

pmod

pointer to model to be tested.

 

dset

dataset struct.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


leverage_test ()

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

Tests the data used in the given model for points with high leverage and influence on the estimates.

Parameters

pmod

pointer to model to be tested.

 

dset

dataset struct.

 

opt

if OPT_S, add calculated series to data set; operate silently if OPT_Q.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


add_leverage_values_to_dataset ()

int
add_leverage_values_to_dataset (DATASET *dset,
                                gretl_matrix *m,
                                int flags);

Adds to the working dataset one or more series calculated by the gretl test for leverage/influence of data points.

Parameters

dset

dataset struct.

 

m

matrix containing leverage values.

 

flags

may include SAVE_LEVERAGE, SAVE_INFLUENCE, and/or SAVE_DFFITS.

 

Returns

0 on successful completion, error code on error.


print_add_omit_null ()

void
print_add_omit_null (const int *list,
                     const DATASET *dset,
                     gretlopt opt,
                     PRN *prn);

Types and Values

enum SeriesSaveCode

Members

SAVE_LEVERAGE

   

SAVE_INFLUENCE

   

SAVE_DFFITS

   

SAVE_TREND

   

SAVE_CYCLE

   

enum ModelAuxCode

Symbolic names to keep track of auxiliary regression models, which are estimated either for the purpose of carrying out some sort of diagnostic test or which form part of a multi-equation system.

Members

AUX_NONE

not an auxiliary regression

 

AUX_SQ

nonlinearity test (squared terms)

 

AUX_LOG

nonlinearity test (log terms)

 

AUX_CHOW

Chow test

 

AUX_ADD

LM test regression for added variables

 

AUX_AR

autocorrelation test

 

AUX_ARCH

ARCH test

 

AUX_WHITE

heteroskedasticity (White's test)

 

AUX_COINT

cointegration test

 

AUX_DF

Dickey-Fuller test

 

AUX_ADF

augmented Dickey-Fuller test

 

AUX_KPSS

KPSS unit-root test

 

AUX_OMIT

unused

 

AUX_RESET

Ramsey's RESET

 

AUX_SYS

single equation from multivariate system

 

AUX_VAR

single equation from VAR system

 

AUX_VECM

single equation from VECM system

 

AUX_JOHANSEN

Johansen cointegration test

 

AUX_GROUPWISE

test for groupwise heteroskedasticity

 

AUX_HET_1

Pesaran-Taylor HET_1 test

 

AUX_BP

Breusch-Pagan heteroskedastcity test

 

AUX_AUX

auxiliary regression not otherwise specified

 

AUX_COMFAC

common factor test

 

AUX_BIPROB

biprobit initializer