opened
M-oplo
username_0
#### Describe the bug

I used AIC / BIC criterion to select the lag oder of a time series, and lag is returned by [ADF test](https://www.statsmodels.org/stable/generated/statsmodels.tsa.stattools.adfuller.html) result. And I used the returned value as 'lag' input in the [Johansen test](https://www.statsmodels.org/stable/generated/statsmodels.tsa.vector_ar.vecm.coint_johansen.html#statsmodels.tsa.vector_ar.vecm.coint_johansen). 

#### Code Sample, a copy-pastable example if possible
from statsmodels.tsa.stattools import adfuller
from statsmodels.tsa.vector_ar.vecm import coint_johansen
lag = adfuller(series)[2]
johansen = coint_johansen(seriesGroup, 0, lag)

clarifications:
1. time series data been used is the prediction result and actual result
2. 'series' is numpy 1D array storing one time series ( the prediction result); 'seriesGroup' is numpy 2D array storing two time series (the prediction result and actual result)

#### Expected Output

return the johansen test value

#### Output of ``import statsmodels.api as sm; sm.show_versions()``

<details>

[  File "/home/I342834/tensor2tensor-transformer_newloss/tensor2tensor-transformer/tensor2tensor/TimeSeries/loss_copy.py", line 118, in johansenTest
    johansen = coint_johansen(seriesGroup, 0, lag)

  File "/usr/local/lib/python3.5/dist-packages/statsmodels/tsa/vector_ar/vecm.py", line 657, in coint_johansen
    temp = inv(np.linalg.cholesky(np.dot(du.T, np.dot(skk, du))))

  File "/usr/local/lib/python3.5/dist-packages/numpy/linalg/linalg.py", line 759, in cholesky
    r = gufunc(a, signature=signature, extobj=extobj)

  File "/usr/local/lib/python3.5/dist-packages/numpy/linalg/linalg.py", line 100, in _raise_linalgerror_nonposdef
    raise LinAlgError("Matrix is not positive definite")

numpy.linalg.LinAlgError: Matrix is not positive definite
]

</details>
johansen test Matrix is not positive definite
issue
created
bashtage
username_1
Are your predictions and your actual identical, so that the variance between the two is 0?
comment
created
bashtage
username_1
What is the value of `lag`?
comment
created
bashtage
username_1
Closing since can't reproduce and no further details.
comment
closed
bashtage
username_1
issue