How to fit a restricted VAR model in R?

2019-07-25 13:40发布

I was trying to understand how may I fit a VAR model that is specific and not general.

I understand that fitting a model such as general VAR(1) is done by importing the "vars" package from Cran

for example

consider that y is a matrix of a 10 by 2. then I did this after importing vars package

y=df[,1:2] # df is a dataframe with alot of columns (just care about the first two)
VARselect(y, lag.max=10, type="const")
summary(fitHilda <- VAR(y, p=1, type="const"))

This work fine if no restriction is being made on the coefficients. However, if I would like to fit this restricted VAR model in R

How may I do so in R? Please refer me to a page if you know any? If there is anything unclear from your prespective please do not mark down let me know what is it and I will try to make it as clear as I understand.

Thank you very much in advance

标签: r time-series
1条回答
贼婆χ
2楼-- · 2019-07-25 14:14

I was not able to find how may I put restrictions the way I would like to. However, I find a way to go through that by doing as follow.

Try to find the number of lags using a certain information criterion like

VARselect(y, lag.max=10, type="const")

This will enable you to find the lag length. I found it to be one in my case. Then afterwards fit a VAR(1) model to your data. which is in my case y.

t=VAR(y, p=1, type="const")

When I view the summary. I find that some of the coefficients may be statistically insignificant.

summary(t)

Then afterwards run the built-in function from the package 'vars'

t1=restrict(t, method = "ser", thresh = 2.0, resmat = NULL)

This function enables one to Estimation of a VAR, by imposing zero restrictions by significance

to see the result write

summary(t1)
查看更多
登录 后发表回答