Why am I getting “LinAlgError: Singular matrix” from grangercausalitytests?

后端 未结 2 499
借酒劲吻你
借酒劲吻你 2020-12-18 21:27

I am trying to run grangercausalitytests on two time series:

import numpy as np
import pandas as pd

from statsmodels.tsa.stattools import grang         


        
2条回答
  •  醉酒成梦
    2020-12-18 21:49

    Another thing to keep an eye out for is duplicate columns. Duplicate columns will have a correlation score of 1.0, resulting in singularity. Otherwise, it's also possible you have 2 features that are perfectly correlated. And easy way to check this is with df.corr(), and look for pairs of columns with correlation = 1.0.

提交回复
热议问题