finance - Non-consecutive number of lags in VAR (R package "vars") -


is possible (in package "vars" or maybe in other r package?) include non-consecutive lags var model, i.e., lags 1 , 3.

so far, looks when set p = 3 under function var, includes consecutive lags between 1 , p (i.e., 1:3).

you can use restrict vars package estimating restricted var. method requires estimate model twice: 1) unrestricted model "consecutive lags" , 2) restricted model lags want. so, becasue restrict function takes input object of class 'varest'. see alternative:

> library(vars) > data(canada) # data > model <- var(canada[,1:2], p=3) # unrestricted var > #bcoef(model) restriction matrix have have same dimension dim(bcoef(model))  # building 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 var lags 1 , 3  > restrict(model, method = "man", resmat = restrict)  var estimation results: =======================   estimated coefficients 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 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  

see ?restrict further details on function.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -