Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Durban's M test code for unbalanced panels


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Durban's M test code for unbalanced panels
Date   Fri, 14 Dec 2007 16:36:19 -0000

I don't know what Durban's M test is. Perhaps you are referring to
something produced by (James) Durbin. But it sounds as if you could ease
your problems by use of -capture-. 

This line is illegal: 

reg U l.Ui lngdata36 lngdata38 lngdata99, noc if unit_id == `i'

Try 
reg U l.Ui lngdata36 lngdata38 lngdata99 if unit_id == `i', noc 

Cosmetically, I would move the -display- statement outside the loop. 

Daniel Wilde

I have a unbalanced panel dataset. I am attempting to test 
whether all the panels have the same AR1 autocorrelation coefficient. I 
thought one way to do this would be to run Durban's M test on each unit
and 
then test to see if the coefficient on the lagged error term was the
same 
for all units. Does that make sense in statistically? I thought the 
following code might do this:

*draft code for panel specific autocorrelation
forvalues i = 1/184 {
display "autocorrelation test on unbalanced panels using  DW's M test"
reg lngdata75 lngdata36 lngdata38 lngdata99 if unit_id == `i'
predict Ui, res
reg U l.Ui lngdata36 lngdata38 lngdata99, noc if unit_id == `i'
estimates store model`i'
drop Ui
more
}

There appear to be two problems. 1) if the ith unit doesn't have enough 
data to run the original regression the code crashes instead of moving
onto 
the next unit. 2) if there are not enough errors to run durban's m test 
then the code crashes. How can I solve these problems?

*
*   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