Python格兰杰因果F检验理解

5w9g7ksd  于 2023-01-18  发布在  Python
关注(0)|答案(2)|浏览(538)

我正在对我的平稳时间序列进行格兰杰因果检验。我很难理解它的置信水平。
对于**,例如1:**

grangercausalitytests(filter_df[['transform_y_x', 'transform_y_y']], maxlag=15)

gives result:

Granger Causality
number of lags (no zero) 1
ssr based F test:         F=3.7764  , p=0.0530  , df_denom=286, df_num=1
ssr based chi2 test:   chi2=3.8161  , p=0.0508  , df=1
likelihood ratio test: chi2=3.7911  , p=0.0515  , df=1
parameter F test:         F=3.7764  , p=0.0530  , df_denom=286, df_num=1

Granger Causality
number of lags (no zero) 2
ssr based F test:         F=2.1949  , p=0.1133  , df_denom=283, df_num=2
ssr based chi2 test:   chi2=4.4673  , p=0.1071  , df=2
likelihood ratio test: chi2=4.4330  , p=0.1090  , df=2
parameter F test:         F=2.1949  , p=0.1133  , df_denom=283, df_num=2

Granger Causality
number of lags (no zero) 3
ssr based F test:         F=7.5713  , p=0.0001  , df_denom=280, df_num=3
ssr based chi2 test:   chi2=23.2818 , p=0.0000  , df=3
likelihood ratio test: chi2=22.3856 , p=0.0001  , df=3
parameter F test:         F=7.5713  , p=0.0001  , df_denom=280, df_num=3

Granger Causality
number of lags (no zero) 4
ssr based F test:         F=2.3756  , p=0.0523  , df_denom=277, df_num=4
ssr based chi2 test:   chi2=9.8113  , p=0.0437  , df=4
likelihood ratio test: chi2=9.6467  , p=0.0468  , df=4
parameter F test:         F=2.3756  , p=0.0523  , df_denom=277, df_num=4

Granger Causality
number of lags (no zero) 5
ssr based F test:         F=1.4871  , p=0.1941  , df_denom=274, df_num=5
ssr based chi2 test:   chi2=7.7338  , p=0.1715  , df=5
likelihood ratio test: chi2=7.6307  , p=0.1778  , df=5
parameter F test:         F=1.4871  , p=0.1941  , df_denom=274, df_num=5

Granger Causality
number of lags (no zero) 6
ssr based F test:         F=1.2781  , p=0.2675  , df_denom=271, df_num=6
ssr based chi2 test:   chi2=8.0363  , p=0.2355  , df=6
likelihood ratio test: chi2=7.9247  , p=0.2437  , df=6
parameter F test:         F=1.2781  , p=0.2675  , df_denom=271, df_num=6

Granger Causality
number of lags (no zero) 7
ssr based F test:         F=1.7097  , p=0.1067  , df_denom=268, df_num=7
ssr based chi2 test:   chi2=12.6378 , p=0.0814  , df=7
likelihood ratio test: chi2=12.3637 , p=0.0892  , df=7
parameter F test:         F=1.7097  , p=0.1067  , df_denom=268, df_num=7

Granger Causality
number of lags (no zero) 8
ssr based F test:         F=1.4672  , p=0.1692  , df_denom=265, df_num=8
ssr based chi2 test:   chi2=12.4909 , p=0.1306  , df=8
likelihood ratio test: chi2=12.2222 , p=0.1416  , df=8
parameter F test:         F=1.4672  , p=0.1692  , df_denom=265, df_num=8

Granger Causality
number of lags (no zero) 9
ssr based F test:         F=2.0761  , p=0.0320  , df_denom=262, df_num=9
ssr based chi2 test:   chi2=20.0400 , p=0.0177  , df=9
likelihood ratio test: chi2=19.3576 , p=0.0223  , df=9
parameter F test:         F=2.0761  , p=0.0320  , df_denom=262, df_num=9

Granger Causality
number of lags (no zero) 10
ssr based F test:         F=1.8313  , p=0.0556  , df_denom=259, df_num=10
ssr based chi2 test:   chi2=19.7977 , p=0.0312  , df=10
likelihood ratio test: chi2=19.1291 , p=0.0387  , df=10
parameter F test:         F=1.8313  , p=0.0556  , df_denom=259, df_num=10

Granger Causality
number of lags (no zero) 11
ssr based F test:         F=1.8893  , p=0.0410  , df_denom=256, df_num=11
ssr based chi2 test:   chi2=22.6493 , p=0.0198  , df=11
likelihood ratio test: chi2=21.7769 , p=0.0262  , df=11
parameter F test:         F=1.8893  , p=0.0410  , df_denom=256, df_num=11

Granger Causality
number of lags (no zero) 12
ssr based F test:         F=2.0157  , p=0.0234  , df_denom=253, df_num=12
ssr based chi2 test:   chi2=26.5779 , p=0.0089  , df=12
likelihood ratio test: chi2=25.3830 , p=0.0131  , df=12
parameter F test:         F=2.0157  , p=0.0234  , df_denom=253, df_num=12

Granger Causality
number of lags (no zero) 13
ssr based F test:         F=1.8636  , p=0.0347  , df_denom=250, df_num=13
ssr based chi2 test:   chi2=26.8434 , p=0.0131  , df=13
likelihood ratio test: chi2=25.6211 , p=0.0191  , df=13
parameter F test:         F=1.8636  , p=0.0347  , df_denom=250, df_num=13

Granger Causality
number of lags (no zero) 14
ssr based F test:         F=1.5283  , p=0.1013  , df_denom=247, df_num=14
ssr based chi2 test:   chi2=23.9090 , p=0.0470  , df=14
likelihood ratio test: chi2=22.9296 , p=0.0614  , df=14
parameter F test:         F=1.5283  , p=0.1013  , df_denom=247, df_num=14

Granger Causality
number of lags (no zero) 15
ssr based F test:         F=0.9749  , p=0.4823  , df_denom=244, df_num=15
ssr based chi2 test:   chi2=16.4815 , p=0.3508  , df=15
likelihood ratio test: chi2=16.0065 , p=0.3816  , df=15
parameter F test:         F=0.9749  , p=0.4823  , df_denom=244, df_num=15

例如2:

grangercausalitytests(filter_df[['transform_y_y', 'transform_y_x']], maxlag=15)

it says:
Granger Causality
number of lags (no zero) 1
ssr based F test:         F=70.4932 , p=0.0000  , df_denom=286, df_num=1
ssr based chi2 test:   chi2=71.2326 , p=0.0000  , df=1
likelihood ratio test: chi2=63.6734 , p=0.0000  , df=1
parameter F test:         F=70.4932 , p=0.0000  , df_denom=286, df_num=1

Granger Causality
number of lags (no zero) 2
ssr based F test:         F=47.3519 , p=0.0000  , df_denom=283, df_num=2
ssr based chi2 test:   chi2=96.3771 , p=0.0000  , df=2
likelihood ratio test: chi2=83.1351 , p=0.0000  , df=2
parameter F test:         F=47.3519 , p=0.0000  , df_denom=283, df_num=2

Granger Causality
number of lags (no zero) 3
ssr based F test:         F=33.6081 , p=0.0000  , df_denom=280, df_num=3
ssr based chi2 test:   chi2=103.3450, p=0.0000  , df=3
likelihood ratio test: chi2=88.2665 , p=0.0000  , df=3
parameter F test:         F=33.6081 , p=0.0000  , df_denom=280, df_num=3

Granger Causality
number of lags (no zero) 4
ssr based F test:         F=24.1709 , p=0.0000  , df_denom=277, df_num=4
ssr based chi2 test:   chi2=99.8248 , p=0.0000  , df=4
likelihood ratio test: chi2=85.6260 , p=0.0000  , df=4
parameter F test:         F=24.1709 , p=0.0000  , df_denom=277, df_num=4

Granger Causality
number of lags (no zero) 5
ssr based F test:         F=15.6663 , p=0.0000  , df_denom=274, df_num=5
ssr based chi2 test:   chi2=81.4760 , p=0.0000  , df=5
likelihood ratio test: chi2=71.6615 , p=0.0000  , df=5
parameter F test:         F=15.6663 , p=0.0000  , df_denom=274, df_num=5

Granger Causality
number of lags (no zero) 6
ssr based F test:         F=11.5874 , p=0.0000  , df_denom=271, df_num=6
ssr based chi2 test:   chi2=72.8595 , p=0.0000  , df=6
likelihood ratio test: chi2=64.8565 , p=0.0000  , df=6
parameter F test:         F=11.5874 , p=0.0000  , df_denom=271, df_num=6

Granger Causality
number of lags (no zero) 7
ssr based F test:         F=9.7282  , p=0.0000  , df_denom=268, df_num=7
ssr based chi2 test:   chi2=71.9090 , p=0.0000  , df=7
likelihood ratio test: chi2=64.0753 , p=0.0000  , df=7
parameter F test:         F=9.7282  , p=0.0000  , df_denom=268, df_num=7

Granger Causality
number of lags (no zero) 8
ssr based F test:         F=8.3121  , p=0.0000  , df_denom=265, df_num=8
ssr based chi2 test:   chi2=70.7626 , p=0.0000  , df=8
likelihood ratio test: chi2=63.1365 , p=0.0000  , df=8
parameter F test:         F=8.3121  , p=0.0000  , df_denom=265, df_num=8

Granger Causality
number of lags (no zero) 9
ssr based F test:         F=7.7863  , p=0.0000  , df_denom=262, df_num=9
ssr based chi2 test:   chi2=75.1583 , p=0.0000  , df=9
likelihood ratio test: chi2=66.6028 , p=0.0000  , df=9
parameter F test:         F=7.7863  , p=0.0000  , df_denom=262, df_num=9

Granger Causality
number of lags (no zero) 10
ssr based F test:         F=6.9230  , p=0.0000  , df_denom=259, df_num=10
ssr based chi2 test:   chi2=74.8427 , p=0.0000  , df=10
likelihood ratio test: chi2=66.3278 , p=0.0000  , df=10
parameter F test:         F=6.9230  , p=0.0000  , df_denom=259, df_num=10

Granger Causality
number of lags (no zero) 11
ssr based F test:         F=6.7168  , p=0.0000  , df_denom=256, df_num=11
ssr based chi2 test:   chi2=80.5233 , p=0.0000  , df=11
likelihood ratio test: chi2=70.7452 , p=0.0000  , df=11
parameter F test:         F=6.7168  , p=0.0000  , df_denom=256, df_num=11

Granger Causality
number of lags (no zero) 12
ssr based F test:         F=6.8729  , p=0.0000  , df_denom=253, df_num=12
ssr based chi2 test:   chi2=90.6239 , p=0.0000  , df=12
likelihood ratio test: chi2=78.4393 , p=0.0000  , df=12
parameter F test:         F=6.8729  , p=0.0000  , df_denom=253, df_num=12

Granger Causality
number of lags (no zero) 13
ssr based F test:         F=6.0868  , p=0.0000  , df_denom=250, df_num=13
ssr based chi2 test:   chi2=87.6748 , p=0.0000  , df=13
likelihood ratio test: chi2=76.1718 , p=0.0000  , df=13
parameter F test:         F=6.0868  , p=0.0000  , df_denom=250, df_num=13

Granger Causality
number of lags (no zero) 14
ssr based F test:         F=5.6246  , p=0.0000  , df_denom=247, df_num=14
ssr based chi2 test:   chi2=87.9896 , p=0.0000  , df=14
likelihood ratio test: chi2=76.3759 , p=0.0000  , df=14
parameter F test:         F=5.6246  , p=0.0000  , df_denom=247, df_num=14

Granger Causality
number of lags (no zero) 15
ssr based F test:         F=5.3775  , p=0.0000  , df_denom=244, df_num=15
ssr based chi2 test:   chi2=90.9098 , p=0.0000  , df=15
likelihood ratio test: chi2=78.5443 , p=0.0000  , df=15
parameter F test:         F=5.3775  , p=0.0000  , df_denom=244, df_num=15

从例如1的几个滞后,p值低于0.05,
我能说y_x格兰杰导致y_y吗
由方程2可知,所有的p值都是0.0000,所以y_y格兰杰导致x_y?
所以因果关系是双向的
如何给予格兰杰因果关系的置信度?
F检验值在这里起作用吗?
在例1中,所有的f检验值都很低,而例2中所有的f检验值都很高。在这种情况下,我可以考虑f检验值来得出结论吗?
如果是,那么F检验要考虑的显著性值是多少?
短暂性脑缺血发作

kr98yfug

kr98yfug1#

从eg.1的几个滞后来看,p值低于0.05,所以我能说y_x格兰杰导致y_y吗?
根据您的问题,我假设您要将p值阈值设置为0.05。在示例1中,对于number of lags (no zero) 1,当p值显示为p=0.0530时,表示过去1的值y_y的(滞后1)(第二列)对y_x的电流值无统计学显著影响对于number of lags (no zero) 3,当p值显示为p=0.0001时,这意味着y_y(第二列)的过去3个值(联合)对y_x(第一列)的当前值具有统计学显著影响。
由方程2可知,所有的p值都是0.0000,所以y_y Granger导致y_x?
类似于上述回答,在所有情况下,对于实施例2,p值〈0.05。这意味着y_x过去值(第二列)对y_y的当前值(第一列)具有统计学上显著的影响。
所以因果关系是双向的
这取决于您要解决的问题,典型的假设是因果关系是单向的。从您的结果来看,您似乎最有可能根据y_x预测y_y的值,而不是相反。如果两个输入信号都是周期性相似的循环信号,则可能会看到y_y的过去值和y_x的当前值之间存在弱相关性。
如何给出格兰杰因果关系的置信度?F检验值在这里起作用吗?在eg.1中,所有的f检验值都很低,而eg.2中,所有的f检验值都很高。在这种情况下,我可以考虑F检验值来得出结论吗?如果可以,那么F检验要考虑的显著性值是什么?
基于自由度,F值和p值相互关联,因为您使用p值阈值意味着您设置F值阈值。
参考文献:

  1. https://stats.stackexchange.com/questions/476536/interpreting-statsmodel-granger-causality-test-results-ssr-chi2test
    1.原始码
  2. Granger causality
  3. f-value calculator
huus2vyu

huus2vyu2#

格兰杰因果检验是一种假设检验,
H0:其他时间序列不影响我们关注的时间序列
H1:H0为假。
如果X和Y是两个时间序列,我们想知道X是否影响Y,那么,
H0:X不是格兰杰原因Y
H1:X格兰杰导致Y,**如果p值〉0.05,则接受H0。**即X不会导致Y。
检验包括评价不同分布下的p值。

**基于SSR的F检验:**在这种情况下,统计量在零假设下具有F分布。
**基于SSR的卡方检验:**本检验的目的是确定观测数据和预期数据之间的差异是由于偶然性,还是由于您正在研究的变量之间的关系。基于卡方分布。
**似然比检验:**基本上是检验结果正确的概率与检验结果不正确的概率之比。
**参数F检验:**可用于推断总体中的两个变量是否相关。F值是两个方差的比值,或从技术上讲,是两个均方的比值。F检验称为参数检验,因为F检验中存在参数。F检验中的这些参数是均值和方差。

相关问题