r - 如何在 R 中对原始平稳和转换后的平稳时间序列进行格兰杰测试?
问题描述
我有三个时间序列的每日频率,分别命名为a、b、c。我已经通过动物园转换了三个时间序列,然后运行三个测试来检查平稳性,这里也有详细说明:
- 所有人的 Ljung-Box <0.01
- ADF 徘徊在 0.01 左右(0.0104、0.01395、0.0151),所以低于 0.05
- KPSS 测试为两个 <0.01,一个为 0.06
这告诉我c是静止的,而a和b不是。要将两个非平稳时间序列转换为平稳,我使用 diff()
diffa <- diff(a)
diffb <- diff(b)
所以现在我有了时间序列c、diffa和diffb。c的长度为 230、diffa和diff 229。由于它们的长度不同,我无法在c、diffa和diffb上运行grangertest()。
我的问题:
- 据我了解,我不应该在已经静止的时间序列上使用 diff() ,尽管这可以解决不同长度的问题。正确的?
- 如何在三个时间序列上运行 grangertest()?我应该添加 0 作为两个现在固定时间序列的第一个值吗?这让我觉得错了。添加 NA 作为第一个值不起作用,因为这会引发错误。
- 或者我在这里完全错过了什么?
编辑:我还运行了 Johansen-Procedure
######################
# Johansen-Procedure #
######################
Test type: trace statistic , with linear trend
Eigenvalues (lambda):
[1] 0.2870433 0.2059927 0.1364341
Values of teststatistic and critical values of test:
test 10pct 5pct 1pct
r <= 2 | 26.70 6.50 8.18 11.65
r <= 1 | 68.68 15.66 17.95 23.52
r = 0 | 130.25 28.71 31.52 37.22
Eigenvectors, normalised to first column:
(These are the cointegration relations)
a.l2 c.l2 b.l2
a.l2 1.000000000 1.00000000 1.000000000
c.l2 0.002389741 -0.01354087 -0.009186882
b.l2 -0.721484628 0.63371350 -5.025730289
Weights W:
(This is the loading matrix)
a.l2 c.l2 b.l2
a.d -0.4943852 -0.1442216 0.03055074
c.d -28.8624865 22.6674082 5.20934270
b.d 0.3205697 -0.1668201 0.05236327
编辑 2:来自 tsDyn 的 VECM 输出
AIC 7310.527 BIC 7364.995 SSR 107996319896
Cointegrating vector (estimated by 2OLS):
a c b
r1 1 -0.0003824692 -0.5213095
ECT Intercept a -1 c -1 b -1
Equation a -0.5926(0.1377)*** 8.7668(12.0209) 0.1257(0.1237) 0.0011(0.0006)* -0.2109(0.0768)**
Equation c 14.7790(21.2262) -26.1263(1852.6566) 1.3814(19.0588) -0.1389(0.0852) -0.8560(11.8419)
Equation b 0.1636(0.2013) 2.6051(17.5698) 0.0168(0.1807) 0.0035(0.0008)*** -0.3475(0.1123)**
解决方案
VECM 与非平稳序列一起工作,因此您将有一个积分顺序为平稳 I(1)。
https://pdf4pro.com/view/vector-error-correction-models-215587.html
推荐阅读
- if-statement - if 语句与值匹配
- ruby - 如何修复服务器上 Sinatra 的损坏依赖项
- reactjs - 如何获取具有更改参数的 URL 的 API
- javascript - Tumblr 默认点赞按钮不呈现“点赞”
- scala - 重写 LogicalPlan 以从聚合中下推 udf
- sql-server - 如何使用 EF Core 在 Visual Studio 中为 SQL Server 数据库视图建模?
- python - 为什么类中定义的函数在其他代码片段中不可见?
- mysql - 如何在 php myqsl 中按年龄创建员工分组
- apache-kafka - 在 JAAS 配置中找不到“KafkaClient”条目
- php - 在 Prestashop 1.7.5 中创建和访问自定义模块的 REST 路由