*! Version 1.2.0 14jun2022

xtistest

xtistest -- Portmanteau test for panel serial correlation, see Inoue & Solon (2006) and Wursten (2018)

Syntax

xtistest
varlist
[if] [in]
[, lags(integer or "all", default = 2) original]

Main
lags check for serial correlation up to order lags

original uses Inoue & Solon calculation (should give same result)

Description

xtistest calculates the Portmanteau test for panel serial correlation described in Inoue & Solon (2006) for varlist of e-residuals.

The IS-test is the panel counterpart to the Q-test for time series. It tests for serial correlation of any order, but can be restricted to only consider autocorrelation up to a certain lag.
The test rapidly loses power as T gets larger if no maximum is given. In general, N should be large relative to T for this test to function.

Options

lags The test looks for autocorrelation up to order lags. Set to 2 by default, to get the full portmanteau test specify lags(all).

original The test by default uses the Born & Breitung (2016) implementation, which is many times faster than the description in IS (2006).
However, we include the original computation option in case anyone were to find a difference in outcomes between the two.

Remarks

Only valid for fixed effect models. Unbalanced panels of any sort are allowed (unlike xtqptest and xthrtest, this test allows gaps in the data).

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.
The 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

. ** Example 1

. sysuse xtline1.dta, clear

. xtreg calories, fe

. predict residuals_1, e

. xtistest residuals_1, lags(1)

. ** Example 2

. clear

. local N = 200

. local T = 5

. set obs `=`N'*`T''

. *** Panel structure

. egen i = seq(), from(1) to(`N')

. egen t = seq(), from(1) block(`N')

. xtset i t

. *** Variables

. **** Fixed effect

. gen c = rnormal(0, 5)

. bysort i (t): replace c = c[1]

. **** Regressors

. gen x1 = rnormal()

. gen x2 = rnormal()

. **** Independent variable

. gen ea = rnormal()

. gen eb = rnormal()

. replace eb = 0.4*L.eb + 0.2*L2.eb + rnormal() if ~missing(L.eb, L2.eb)

. gen ya = c + 0.03*x1 + 0.6*x2 + ea

. gen yb = c + 0.03*x1 + 0.6*x2 + eb

. *** Regress

. xtreg ya x1 x2, fe

. predict res_a, e

. xtreg yb x1 x2, fe

. predict res_b, e

. *** Test residuals

. xtistest res*, lags(2)

. *** Test as postestimation

. xtreg ya x1 x2, fe

. xtistest, lags(2)

Stored results

xtistest stores the following in r():

Matrices

r(p) p values

r(IS) values of the IS statistics

Scalars

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

r(isi) Same for the is-statistics

References

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

A Portmanteau Test for Serially Correlated Errors in Fixed Effects Models, Atsushi Inoue and Gary Solon, Econometric Theory 2006

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