了解 R 中的 vec2var 转换

机器算法验证 r 时间序列 计量经济学 向量自回归 矢量纠错模型
2022-03-16 21:03:47

我正在使用 Bernhard Pfaff 的包 {urca} 和 {vars} 来分析 3 个时间序列。每个都是 I(1) 并且与协整关系协整。r=2

vec2var () 命令应该将ca.jo对象(我的 VECM)转换为它的 VAR 表示形式但是我不明白vec2var () 的输出,也不明白如何对此输出执行 VAR 分析(即,将数据发送到VAR () 函数以获取varest对象)。

也就是说,在从 VECM 转换为 VAR 之后,我向VAR () 函数(执行标准 VAR 估计)发送什么?应该是:

var.form$A%*%var.form$datamat[ , c(6:11)] + var.form$deterministic%*%var.form$datamat[ , c(4:5)]

上面代码中的维度是因为我有变量、滞后、常数项和确定性趋势。K=3p=2

但是vec2var () [基于上面的 R 代码] 的公式类似于 即具有确定性时间趋势和常数的基本 VAR(2)。

Yt=A1Yt1+A2Yt2+ΦDt+μ+ϵt

但这就是我感到困惑的地方:长期 VECM 的 VAR 形式(等式 4.8a,在 Pfaff 的使用 R. userR 对集成和协集成时间序列的分析中!以及其他地方,例如Lütkepohl eq'n 7.1。 1) 是:

Δyt=Γ1Δyt1+Γ2Δyt2+Πyt2+ΦDt+μ+ϵt

为了获得正确的 VAR 级别表示,我是否必须从vec2var () 获取数据并自己操作它?(即找到差异序列,然后乘以适当的协整矩阵)?如果是这种情况,那么[请在 R 代码中!] 系数矩阵应该乘以哪个向量?

我觉得理论和数学形式主义以及这些 R 包之间存在脱节......但更有可能我错过了一些非常基本的东西。

这是基本的 R 代码设置:

library(urca) 
library(vars) 

vecm <- ca.jo(mydata, ecdet = "trend", type = "trace",  spec = "longrun") 
var.form <- vec2var(vecm, r= 2) 
# The output data I get can be seen from names(var.form), but the key parts are: 

var.form$y          # my original data 
var.form$datamat    # original data organized with the three variables (starting at t = 2), the constant term, trend term and then six columns with two lagged levels at t=1 and t=0. 

# the coefficients for the regressors on the endogenous variables (A) and deterministic components are:
     var.form$A             # lagged variable coefficients (levels only, I think) 
     var.form$deterministic     # constant and time trend coefficients
1个回答

vec2var()函数将提供一个类对象vec2var您无法将其进一步转换varest为标准 VAR 的类,但仍有许多方法可以使用,请检查:

methods(class = "vec2var")

将返回:

[1] fevd 拟合 irf logLik Phi 图预测打印 Psi 残差

因此,您可以根据需要运行irf()fevd()等等,以“对此输出执行 VAR 分析”。例如,如果您想运行 IRF,请执行以下操作:

plot(irf(vec2var(x)))

唯一不能轻易得到的是(受约束的)VAR 表示的系数的标准误差。