Multivariate Breusch Godfrey Lagrange Multiplier tests in Python

蓝咒 提交于 2019-12-11 07:34:47

问题


I understand that in the package statsmodel has many statistical functions that enable one to test for many issues including Breusch Godfrey Lagrange test as described here

However, as far as I am concerned this only do the job for univariate case and not the multivariate case.

For example, consider I have a 2 diminsional dataset say data

from statsmodels.tsa.api import VAR
import statsmodels.api as sm,statsmodels as sm1

data= np.random.random((108, 2))
Model=VAR(data)
results = Model.fit(1)
sm.stats.diagnostic.acorr_breusch_godfrey(results)

Output: 
in acorr_breusch_godfrey(results, nlags, store)
    501         nlags = int(nlags)
    502 
--> 503     x = np.concatenate((np.zeros(nlags), x))
    504 
    505     #xdiff = np.diff(x)

ValueError: all the input arrays must have same number of dimensions

Hence, obviously, this only work for one dimensional, is anyone aware how to test for Breusch Godfrey in the multivariate setting?

来源:https://stackoverflow.com/questions/46302347/multivariate-breusch-godfrey-lagrange-multiplier-tests-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!