Statalist


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

st: Durban's M test code for unbalanced panels


From   Daniel Wilde <[email protected]>
To   [email protected]
Subject   st: Durban's M test code for unbalanced panels
Date   Fri, 14 Dec 2007 16:18:55 +0000

All,

Firstly, thanks to everyone who helped me with the by graph query.

Secondly, 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?

Thanks

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