我正在尝试在statsmodel中使用Vector Autoregression(VAR)模型进行研究。输入数据是具有高维向量的矩阵。代码如下:
from statsmodels.tsa.vector_ar.var_model import VAR
model = VAR(data)
fit = model.fit(maxlags=3,ic='aic')
test = fit.forecast(1)
然而,当我执行它时,我得到了一个错误:
File "/Users/Documents/code/VAR.py", line 39, in test_var
fit = model.fit(maxlags=3,ic='aic')
File "/Users/anaconda3/lib/python3.5/site-packages/statsmodels/tsa/vector_ar/var_model.py", line 423, in fit
selections = self.select_order(maxlags=maxlags, verbose=verbose)
File "/Users/anaconda3/lib/python3.5/site-packages/statsmodels/tsa/vector_ar/var_model.py", line 508, in select_order
for k, v in iteritems(result.info_criteria):
File "/Users/anaconda3/lib/python3.5/site-packages/statsmodels/base/wrapper.py", line 35, in __getattribute__
obj = getattr(results, attr)
File "/Users/anaconda3/lib/python3.5/site-packages/statsmodels/tools/decorators.py", line 97, in __get__
_cachedval = self.fget(obj)
File "/Users/anaconda3/lib/python3.5/site-packages/statsmodels/tsa/vector_ar/var_model.py", line 1471, in info_criteria
ld = logdet_symm(self.sigma_u_mle)
File "/Users/anaconda3/lib/python3.5/site-packages/statsmodels/tools/linalg.py", line 219, in logdet_symm
c, _ = linalg.cho_factor(m, lower=True)
File "/Users/anaconda3/lib/python3.5/site-packages/scipy/linalg/decomp_cholesky.py", line 132, in cho_factor
check_finite=check_finite)
raise LinAlgError("%d-th leading minor not positive definite" % info)
numpy.linalg.linalg.LinAlgError:第98位领先的未成年人
我对这里的数学理论并不熟悉,我想知道如何解决这个问题。(例如,我是否应该首先进行任何数据预处理方法。)