Reputation: 165
I am developing a VAR model using quarterly data with the vars package. To specify autoregressors, the VAR function within this package gives you have two choices. You can either let R select the best lags for you up to a maximum you set up using 'lag.max.' In this case, given I have quarterly data I would set it at 4. However, I am unclear how well this function truly selects the best lags this way. It seems every time I do it that way, R appears to select the first 3 quarterly lags. Theory and practice suggests Lag 4 is often better than the others because it picks up seasonality (quarterly data). Now, the other way to specify your lags is to use the "p" argument. So, if you state p = 1. It will do the 1st lag. But, if you do p = 4; it won't do just the 4th lag (the one I want). Instead, it does all four lags up to the 4th one (Lag 1, Lag 2, Lag 3, Lag 4). How can you specify just using Lag 4? Is that not possible, because it is braking the actual structure of VAR models?
Upvotes: 0
Views: 2293
Reputation: 61164
You can use restrict
function in vars package to get the model you want.
> library(vars) # this is an example
> data(Canada)
> var.u <- VAR(Canada, p = 4) # first the unrestricted VAR
>
> # building the restriction matrix only for lag 4
> resmat <- Bcoef(var.u)*0
> resmat[, c(16,17)] <- 1
>
> # the result you want, the restricted VAR at lag 4
> restrict(var.u, method="manual", resmat=resmat)
Upvotes: 0