2013-05-14 104 views

回答

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 

有關此功能的更多詳細信息,請參閱?restrict

+0

非常感謝你,Jilber! – user2323534 2013-05-14 18:08:21

+1

@ user2323534如果這個答案解決了你的問題,你可以接受它作爲正確的答案,並upvote它也。 :D這是這個地方的工作原理。 – 2013-05-14 21:04:13