我正在尝试使用格兰杰因果关系测试:https ://www.statsmodels.org/stable/generated/statsmodels.tsa.stattools.grangercausalitytests.html
评估“积极性分数”是否影响价值。
这是我正在使用的代码:
# Applying differencing
condensed_df['value'] = condensed_df['value'] - condensed_df['value'].shift(1)
condensed_df = condensed_df.drop(0)
# Running granger causality test
dct_pos_granger_causality = grangercausalitytests(condensed_df[["value", daily_avg_positive_score"]], maxlag = 4, verbose=False)
我在数据框中总共有 1,008 行。
结果如下:
{1: ({'ssr_ftest': (0.005356633438031601, 0.941670291866298, 1003.0, 1), 'ssr_chi2test': (0.0053726552728412666, 0.9415686658133314, 1), 'lrtest': (0.005372640925997985, 0.9415687436896775, 1), 'params_ftest': (0.0053566334379265765, 0.9416702918669032, 1003.0, 1.0)})
2: ({'ssr_ftest': (0.25177289420871873, 0.7774705403356538, 1000.0, 2), 'ssr_chi2test': (0.5060635173595247, 0.7764432226205071, 2), 'lrtest': (0.5059361470375734, 0.7764926721067107, 2), 'params_ftest': (0.25177289420872345, 0.7774705403356538, 1000.0, 2.0)})
3: ({'ssr_ftest': (0.24649533124441178, 0.8638565929333925, 997.0, 3), 'ssr_chi2test': (0.7446779716230374, 0.862648253967841, 3), 'lrtest': (0.7444019401355035, 0.8627137383746588, 3), 'params_ftest': (0.2464953312443746, 0.8638565929334187, 997.0, 3.0)})
4: ({'ssr_ftest': (0.6384235515822775, 0.6351740781255001, 994.0, 4), 'ssr_chi2test': (2.576816186064484, 0.6309354793595714, 4), 'lrtest': (2.57351178378849, 0.6315224927789413, 4), 'params_ftest': (0.6384235515823179, 0.6351740781254609, 994.0, 4.0)})}
我正在努力解释结果。我是否正确地认为,以第一个 ssr_chi2test 为例,(0.0053726552728412666, 0.9415686658133314, 1),0.005 代表检验统计量,0.94 代表 P 值,1 代表自由度?
如果这是正确的,那么零假设绝对不能被拒绝,并且在只有一个自由度的情况下可能没有足够的数据?
任何清晰度将不胜感激!