Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: autocorrelation in pooled time series


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   Re: st: autocorrelation in pooled time series
Date   Wed, 26 Nov 2003 04:18:30 -0000 (GMT)

Sandy,

Apologies for the last reply I sent to you on this: frankly, it was rubbish.

I'm afraid this one might not be much better. The only thing I can find
that comes close to what you're looking for is an ado-file written by
Bernhard Kittel (based on an earlier program by Kit Baum) called
-xtactest-. Here it is:

*! version 1.0  BKittel
* from xttest2 v1.0.3 and sureg
* following Baltagi 2001, 95 (eq. 5.42)

program define xtactest, rclass
	version 7.0

	if "`e(cmd)'"=="xtreg" { local est 1 }
	if "`e(cmd)'"=="xtgls" { local est 2 }
	if "`est'" ==""	{ error 301 }
	if "`e(model)'" != "fe" & "`est'"=="1" {
		di in red "last estimates not xtreg, fe"
		exit 301
	}
	if "`*'"!="" { error 198 }

	tempname xb res ret ng tb cov cor vv vvl lm siglm

	preserve
* number of cross sections
	local ng = e(N_g)
* min length of time series
	local tb = e(g_min)

* compute fixed effect e(i,t)
	if "`est'"   == "1" {
		qui predict double `res', e
	}
	else {
		qui predict double `xb'
		qui gen double `res' = `e(depvar)'-`xb'
	}

* compute e(i,t-1) and drop first period
        qui gen double `ret' = l.`res'
	qui drop if `res' == . | `ret' == .

* compute LM test statistic
	mat accum `cov' = `res' `ret', noc
	* mat `cor' = corr(`cov')
    	* mat list `cor', nohead format(%9.4f)
	local vv = `cov'[1,1]
	local vvl = `cov'[2,1]
	local lm = ((`ng' * `tb'^2)/(`tb' - 1)) * (`vvl'/`vv')^2

    di
    di in gr "Baltagi and Li LM test of serial correlation: chi2(1) = " /*
    */ in ye %9.3f `lm' in gr ", Pr = " %6.4f /*
    */ in ye chiprob(1,`lm')

    ret scalar lm_bl = `lm'
end
exit

The trouble is is that this only provides significance tests on rho after
-xtgls-, not -xtpcse-. Apologies if you're already aware of this. I share
your concern about this, because I too am fitting OLS-PCSE models at
present, although I'm much more of a novice at it than you are.

C.

Sandy Smith wrote:

> A colleague and I have been using the Stata command "xtpcse" to analyze
> pooled
> time series, cross-sectional data.   We've been pleased with the results,
> but
> are stuck on a question about autocorrelation.
>
> When you include an AR(1) term, rho is reported in the output.  Generally,
> our
> understanding is that if rho is significant, the AR(1) term is necessary.
> However, in the Stata output, there is no significance test for rho.
>
> Does anyone know how to determine if rho is significant when using xtpcse?
>
> Alternately, does anyone know a better test for autocorrelation in using
> xtpcse in Stata?

Yours,
CLIVE NICHOLAS,
Politics Building,
School of Geography, Politics and Sociology,
University of Newcastle-upon-Tyne,
Newcastle-upon-Tyne,
NE1 7RU,
United Kingdom.
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index