Breusch-Godfrey test dimensions mismatch
I'm trying to use Breusch-Godfrey test for ARDL(0, q) residuals, and I get a "ValueError: all the input array dimensions except for the concatenation axis must match exactly". It is due to the fact that list of residuals is shorter than list of exogenous variables by 2. Is it possible to omit the first q rows of exog_old before calling np.column_stack, or there is some econometric background for them staying there?
Here is some example code:
data = pd.DataFrame(np.random.rand(100, 2), columns=['x', 'y'])
model_ardl = ARDL(endog=data.y, lags=0, exog=data[['x']], order=2, causal=False).fit()
acorr_breusch_godfrey(model_ardl)
Thanks for reporting. I will need to take a look at this, and possibly some other tests for ARDL compatability.
In case of Breuch-Godfrey, the whole fix was just as follows (I added it right after setting these variables and it worked):
if nobs < len(exog_old):
exog_old = exog_old[-nobs:]
I guess the same thing will be with other tests - just take last n_obs exogenous and that's it. I tested it against similar code in R, and it returned pretty much the same results (on my data I got chi2 test statistic of 22.621 in R and 22.619 in Statsmodels).