如何在 R 中拟合受限 VAR 模型? [英] How to fit a restricted VAR model in R?
问题描述
我试图了解如何拟合特定且不一般.
据我所知,拟合诸如一般 VAR(1) 之类的模型是由从 Cran 导入vars"包
例如
认为 y 是一个 10 x 2 的矩阵.然后我在导入 vars 包后这样做了
y=df[,1:2] # df 是一个有很多列的数据框(只关心前两个)VARselect(y, lag.max=10, type="const")总结(fitHilda <- VAR(y,p=1,类型=const"))
如果对系数没有限制,这可以正常工作.但是,如果我想在 R 中拟合这个受限制的 VAR 模型
>
我如何在 R 中这样做?如果你知道,请给我一个页面?如果您有任何不清楚的地方,请不要记下,让我知道它是什么,我会尽量把它说清楚.
非常感谢您提前
我无法找到如何按照我想要的方式设置限制.但是,我找到了一种方法来通过执行以下操作.
尝试使用特定的信息标准(如
)找出滞后的数量VARselect(y, lag.max=10, type="const")
这将使您能够找到滞后长度.我发现它是我的情况之一.然后将 VAR(1) 模型拟合到您的数据中.在我的情况下是 y.
t=VAR(y, p=1, type="const")
当我查看摘要时.我发现某些系数在统计上可能不显着.
summary(t)
然后从包'vars'运行内置函数
t1=restrict(t, method = "ser", thresh = 2.0, resmat = NULL)
此函数通过按重要性强加零限制来实现对 VAR 的估计
看结果写
summary(t1)
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
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)
这篇关于如何在 R 中拟合受限 VAR 模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!