【发布时间】:2021-04-19 01:52:03
【问题描述】:
我目前正尝试在 R/R Studio 中运行格兰杰因果分析。使用函数grangertest() 时,我收到有关混叠系数的错误。据我了解,这是因为变量之间存在完美的多重共线性。
由于有大量的成对比较(例如 200+),我想简单地按照正常运行带有别名系数的 granger,而不是返回错误。根据一个答案here,解决方案是或者是添加集合singular.ok=TRUE,但要么我做错了答案已经过时了。我试过检查文档,但结果是空的。任何帮助将不胜感激。
library(lmtest)
x <- c(0,1,2,3)
y <- c(0,3,6,9)
grangertest(x,y,1) # I want this to run successfully even if there are aliased coefficients.
grangertest(x,y,1, singular.ok=TRUE) # this also doesn't work
"Error in waldtest.lm(fm, 2, ...) :
there are aliased coefficients in the model"
另外有没有办法标记x 和y 实际上是别名变量?似乎有一些答案,例如here,但我在让它正常工作时遇到了问题。
alias((x~ y))
提前致谢。
【问题讨论】:
标签: r statistics time-series regression