variables - In R, using the vars package doing a VAR model, how to specify one specific lag within the p argument? -
i developing var model using quarterly data vars package. specify autoregressors, var function within package gives have 2 choices. can either let r select best lags maximum set using 'lag.max.' in case, given have quarterly data set @ 4. however, unclear how function selects best lags way. seems every time way, r appears select first 3 quarterly lags. theory , practice suggests lag 4 better others because picks seasonality (quarterly data). now, other way specify lags use "p" argument. so, if state p = 1. 1st lag. but, if p = 4; won't 4th lag (the 1 want). instead, 4 lags 4th 1 (lag 1, lag 2, lag 3, lag 4). how can specify using lag 4? not possible, because braking actual structure of var models?
you can use restrict
function in vars package model want.
> library(vars) # example > data(canada) > var.u <- var(canada, p = 4) # first unrestricted var > > # building restriction matrix lag 4 > resmat <- bcoef(var.u)*0 > resmat[, c(16,17)] <- 1 > > # result want, restricted var @ lag 4 > restrict(var.u, method="manual", resmat=resmat)
Comments
Post a Comment