*! version 1.1.2 06apr2018

xthrtest

xthrtest -- Heteroskedasticity-robust HR-test for first order panel serial correlation, see Born & Breitung (2016) and Wursten (2018)

Syntax

xthrtest
varlist
[if] [in]
[, force]

Main
force skips checking if residuals include the fixed effect

Description

xthrtest calculates the (time dependent) heteroskedasticity-robust HR statistic for serial correlation described in Born & Breitung (2016) for varlist of ue-residuals.

The underlying concept of the test boils down to regressing backwards demeaned residuals on lagged forward demeaned residuals using a heteroskedasticity and autocorrelation robust estimator.
An F-test is then performed on the estimated coefficients. xthrtest calculates the HR statistic that is asymptotically equivalent to this F-test.

Options

force The test only works if the dataset contains no gaps and the residuals provided include the fixed effect. Force skips testing if the latter is true.

Remarks

Only valid for fixed effect models without gaps. Unbalanced panels (different starts/ends) are allowed.

You must use the ue-option when predicting the residuals. That is, this test requires the fixed effect-included residuals (ci + eit).

Any mistakes are my own.

Just like academic papers, coding software takes time and effort. As a result, please cite the Stata Journal article, Wursten (2018), when you make use of this command, just like you would cite a useful paper. A full reference can be found below.
This article contains additional information about the tests, its usage and its strengths, as well as some Monte Carlo evidence.

Examples

. sysuse xtline1.dta, clear

. xtreg calories, fe

. predict ue_residuals_1, ue

. xthrtest ue_residuals_1

Stored results

xthrtest stores the following in r():

Matrices

r(p) p values

r(HR) values of the Q(P) statistics

Scalars

r(pvaluei) The p-values are also stored as scalars (often more convenient)

r(hri) Same for the hr-statistics

References

Testing for Serial Correlation in Fixed-Effects Panel Data Models, Benjamin Born and Jörg Breitung, Econometric Reviews 2016

Testing for serial correlation in fixed-effects panel models, Jesse Wursten, Stata Journal 2018

Author

Jesse Wursten
Faculty of Economics and Business
KU Leuven
jesse.wursten@kuleuven.be