VAR lag length vs Johansen cointegration test outcome? First puzzle:
I am taught that the lag order of VECM does not affect the cointegration rank because the lag order is for the differenced regressors. But, I see the contrary: I experimented with sample data of 4 variables, using lag orders between 1 and 12. At low lag orders the cointegration rank is low, but as I increase the lag length, cointegration rank goes up. Does anyone know of a paper or source discussing this issue? Any suggestions as to what to do in this situation?
Second puzzle:
If I go by what information criteria indicate as an optimal lag length, establish the coinegration rank and then set up a VECM model, the residuals of the model are heteroscedastic and serially correlated. The info criteria based lag order is 2. To circumvent the issue, I have two options:


*

*Go back, increase the lag order and set up a new VECM and do diagnostic tests

*Just keep the cointegration rank as it is and increase the lag order
until the residuals are homoscedastic and free of autocorrelation
What would be the optimal course of action?
 A: This is a usual problem with the two steps procedure, where one selects first the lag, then the cointegration rank depending on the lag chose in the first step. 
Puzzle 1: The claim that the lag order does not matter for the cointegration test depends on the type of test: 


*

*VAR based test: if you use a Johansen test, the lag matters!  

*Residual-based test (cf Engle-Granger, Phulips-Ouliaris), then yes, the lag order does not matter
Puzzle 2: My favourite approach is the simultaneous-selection approach, where you choose the lag and rank based on a simlutaneous criterion selection (This is implemented in package tsDyn in R for example, see http://www.inside-r.org/packages/cran/tsDyn/docs/rank.select). See references below. 
Now what should you do if the ideal criterion selects a model where there is still some auto-correlation in errors? Great question, and I am not aware of papers tackling this directly. So one option would be to increase lags till you get a model with good residuals. Another option would be to stick with the AIC/BIC choice, and use heteroskedasticity and autocorrelation robust estimators (HAC) for any test you do (t-test, Granger causality, etc). Cheng an Philips (2009) show that their AIC/BIC lag/rank procedure is robust even in presence of auto-correlation (hence the name of semi-parametric). The issue is probably that few softwares will allow you do to this for all tests, in particular, IRF, usually computed with bootstrap, might not include a bootstrap scheme mimicking auto-correlation.  


*

*Aznar A and Salvador M (2002). Selecting The Rank Of The Cointegration Space And The Form Of The Intercept Using An Information Criterion. Econometric Theory, 18(04), pp. 926-947. .

*Cheng X and Phillips PCB (2009). Semiparametric cointegrating rank selection. Econometrics Journal , 12(s1), pp. S83-S104. 
