I have an unbalanced panel dataset where both autocorrelation and heteroskedasticity are present. I have read, in the Stata manual, that the newey command (see Newey-West, 1987) is one way in which these two problems may be addressed simultaneously. However, my understanding is that I must stipulate a lag(m) option, where autocorrelation at lags greater than m can be ignored. My question is how to determine what 'm' should be? Is there some way to determine how many lags I should be using?
I have found some discussion online about a type of stationary test where I would calculate first differences, second differences, etc. and then run the test for autocorrelation. Once I reach "stationary", I should know how many lags to use. But, I can't find any information on what this test is or how to use it.
Any help would be appreciated!