VAR中的非连续滞后数(R包“vars”)
是否有可能(包内或其他R包内?)将非连续滞后纳入var模型,即仅滞后1和3VAR中的非连续滞后数(R包“vars”),r,lag,finance,risk-analysis,R,Lag,Finance,Risk Analysis,是否有可能(包内或其他R包内?)将非连续滞后纳入var模型,即仅滞后1和3 到目前为止,当我在函数VAR下设置p=3时,它似乎包括了1和p之间的所有连续滞后(即1:3)。您可以使用vars包中的restrict来估计受限VAR。此方法需要估计模型两次:1)具有所有“连续滞后”的非受限模型2)一个只有你想要的滞后的受限模型。这是因为restrict函数将类“varest”的对象作为输入。请参见我的备选方案: > library(vars) > data(Canada) # some d
到目前为止,当我在函数
VAR
下设置p=3时,它似乎包括了1和p之间的所有连续滞后(即1:3)。您可以使用vars包中的restrict
来估计受限VAR。此方法需要估计模型两次:1)具有所有“连续滞后”的非受限模型2)一个只有你想要的滞后的受限模型。这是因为restrict
函数将类“varest”的对象作为输入。请参见我的备选方案:
> library(vars)
> data(Canada) # some data
> model <- VAR(Canada[,1:2], p=3) # The unrestricted VAR
> #Bcoef(model) The restriction matrix have to have the same dimension as dim(Bcoef(model))
# Building the restriction matrix
> Restrict <- matrix(c(1,1,0,0,1,1,1,
1,1,0,0,1,1,1), nrow=2, byrow=TRUE)
# Re-estimating the VAR with only lags 1 and 3
> restrict(model, method = "man", resmat = Restrict)
VAR Estimation Results:
=======================
Estimated coefficients for equation e:
======================================
Call:
e = e.l1 + prod.l1 + e.l3 + prod.l3 + const
e.l1 prod.l1 e.l3 prod.l3 const
1.2029610 0.1885456 -0.2300286 -0.1299485 1.8382368
Estimated coefficients for equation prod:
=========================================
Call:
prod = e.l1 + prod.l1 + e.l3 + prod.l3 + const
e.l1 prod.l1 e.l3 prod.l3 const
0.05511963 1.13333804 -0.03338699 -0.18646375 1.22037293
>库(vars)
>数据(加拿大)#一些数据
>模型#Bcoef(模型)约束矩阵的维数必须与dim(Bcoef(模型))相同
#构建约束矩阵
>限制限制(模型,方法=“人”,resmat=Restrict)
VAR估计结果:
=======================
方程e的估计系数:
======================================
电话:
e=e.l1+prod.l1+e.l3+prod.l3+const
e、 l1生产线l1 e.l3生产线l3常数
1.2029610 0.1885456 -0.2300286 -0.1299485 1.8382368
方程prod的估计系数:
=========================================
电话:
prod=e.l1+prod.l1+e.l3+prod.l3+const
e、 l1生产线l1 e.l3生产线l3常数
0.05511963 1.13333804 -0.03338699 -0.18646375 1.22037293
有关此功能的更多详细信息,请参见
?restrict
。@user23534如果此答案解决了您的问题,您可以将其作为正确答案接受,并对其进行投票:这就是这个地方的运作方式。