.-
help for ^xttest2^                             (SSC distribution, 9 August 2022)
.-

Breusch-Pagan LM test for cross-sectional correlation in fixed effects model
----------------------------------------------------------------------------

    ^xttest2^ 


^xttest2^ is for use with cross-section time-series data, following use of 
^xtreg, fe^, ^xtreg, re^, ^xtgls^ or ^ivreg2^, and requiring prior use of ^tsset^.


Description
-----------

^xttest2^ calculates the Breusch-Pagan statistic for cross-sectional 
independence in the residuals of a panel data regression model, following 
Greene (2000, p. 601) or Pesaran (2015, p. 1092).
 ^xtreg, fe^ or ^xtreg, re^ estimates this model assuming independence 
of the errors. A likely deviation from independent errors in the context of 
pooled cross-section time-series data (or panel data) is likely to be 
contemporaneous correlations across cross-sectional units. These correlations 
are those exploited by Zellner's seemingly unrelated regression (SUR) 
estimator, and this test is provided by ^sureg, corr^ in that context.  
^xttest2^ tests the hypothesis that the residual correlation matrix, computed 
over observations common to all cross-sectional units, is an identity matrix 
of order N_g, where N_g is the number of cross-sectional units. The resulting 
test statistic is distributed Chi-squared(d), where d=N_g * (N_g - 1) /2, 
under the null hypothesis of cross-sectional independence.

In the context of an unbalanced panel, the observations used to calculate 
the test statistic are those available for all cross-sectional units. The 
number of available observations is reported, as is the estimated correlation
matrix of the residuals over cross-sectional units.

Since this routine makes use of Stata's matrix language, it cannot compute
the test if the number of panels in the data exceeds the current matsize 
(^help matsize^). 

The test statistic, degrees of freedom and number of available observations 
are placed in the return array.

Note that this Breusch-Pagan test is not that commonly employed to test for
heteroskedasticity.
 

Example
-------

	. ^use http://fmwww.bc.edu/ec-p/data/greene2000/TBL15-1.dta,clear^

	. ^tsset firm year^
	
	. ^xtreg i f c,fe^
	
	. ^xttest2^
		
	. ^xtreg i f c,re^
	
	. ^xttest2^
		
	. ^xtgls i f c, p(h)^
	
	. ^xttest2^
	
	. ^ivreg2 i (f c = L.i year)^
	
	. ^xttest2^


References
----------

Greene, W. 2000. Econometric Analysis. Upper Saddle River, NJ: Prentice--Hall. 

Pesaran, M.H. 2015. Testing weak cross-sectional dependence in large panels.
Econometric Reviews, 34:6-10, 1089-1117. DOI: 10.1080/07474938.2014.956623


Acknowledgement
----------------

Thanks to Sylvain Friederich for suggesting that this routine be written.
 

Author
------

Christopher F Baum, Boston College, USA
baum@@bc.edu


Also see
--------

On-line:  help for @sureg@, @xttest3@ (if installed), @bpagan@ (if installed), @ivreg2@ (if installed)