I am working on vector auto-regression (VARs) and impulse response function (IRFs) estimation based on panel data with 33 individuals over 77 quarters. How should this type of situation be analyzed? What algorithm's exist for this purpose? I would prefer to conduct these analyses in R, so if anyone is familiar with R code or a package designed for this purpose that they could suggest, that would be especially helpful.

- 132,789
- 81
- 357
- 650

- 115
- 1
- 6
-
Welcome to the site, @Roman. Asking for R packages is off-topic for CV (see our [help page](http://stats.stackexchange.com/help)). Moreover, this Q would be off-topic on [Stack Overflow](http://stackoverflow.com/) as well. You might try the r-help listserv. – gung - Reinstate Monica Oct 16 '13 at 17:34
-
This question appears to be off-topic because it is about asking for R packages. – gung - Reinstate Monica Oct 16 '13 at 17:34
-
could I ask for the algorithm for panel VAR estimation? – Rom Oct 16 '13 at 17:40
-
3Sure, you can ask about how to deal w/ this situation, & in the process of answering someone might be able to provide some helpful R code (or not...). It's just asking 'what package will do X' that's off-topic. If you want the question to stay here (& stay open), just edit your Q to make it on-topic. It may help you to read the [relevant section of the help page](http://stats.stackexchange.com/help/on-topic) & our [guide to asking questions](http://meta.stats.stackexchange.com/questions/1479/how-to-ask-a-good-question-on-crossvalidated) in reformulating your Q. – gung - Reinstate Monica Oct 16 '13 at 17:51
-
I edited this in the hopes that it might lead to more productive answers for you. Please make sure it is still asking what you want to know & see if you like it. If not, click "rollback" to return it to your last edit with my apologies. – gung - Reinstate Monica Oct 16 '13 at 18:18
-
I don't know the answer to your question, but I think you may be able to get helpful responses now. GL – gung - Reinstate Monica Oct 16 '13 at 18:30
6 Answers
Common panel data vector autoregression models include the Arellano-Bond estimator (commonly referred to as "difference" GMM), the Blundell-Bond estimator (commonly referred to as "system" GMM) and the Arellano-Bover estimator. All use GMM, and begin with a model: $$y_{it}=\sum_{l=1}^p\rho_ly_{i,t-l}+x_{i,t}'\beta+\alpha_i+\epsilon_{it} $$
Arellano and Bond takes the first difference of $y_{i,t}$ to remove the fixed effect, $\alpha_i$ and then uses lagged levels as instruments: $$ E[\Delta \epsilon_{it}y_{i,t-2}]=0$$
This is basically the same as the procedure detailed in this Holtz-Eakin Newey Rosen article, which also provides some instructions for implementation.
Blundell and Bond use lagged first differences as instruments for levels:
$$ E[\epsilon_{it}\Delta y_{i,t-1}]=0$$ The name "system" GMM usually means a mix of these instruments with those from Arellano Bond.
Arellano and Bover use the system GMM and also explore forward demeaning of variables, which to my knowledge is not directly implemented for R
, but you can check out their paper for details.
In R
, both Arellano-Bond and Blundell-Bond are implemented in the plm
package, under the command pgmm
. The documentation I've linked to provides instructions and examples for exactly how to implement them.

- 2,155
- 12
- 16
-
Thank you very much! I used plm package for simple panels. And I was worring about its application for PVARs. Thank you. – Rom Nov 24 '14 at 17:25
-
1https://www.researchgate.net/publication/322526372_panelvar_044 you will find the package here. Good luck with your research – Michael Sigmund Jan 20 '18 at 20:16
You can use a system of seemingly unrelated regression equations (using the package systemfit) after you convert the dataset with pdata.frame (plm package). You need to derive the impulse response functions by yourself. If you follow Hamilton's or Greene's textbook, it should not be too complicated.

- 31
- 3
I just found this paper "Panel Vector Autoregression in R: The Panelvar Package" (2017) by Michael Sigmund, Robert Ferstl and Daniel Unterkofler, which basically is a description of the methods implemented in R. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2896087
Additionally, there's another question here: Panel vector autoregression models in R?
The authors are now in the process of publishing the code on CRAN, but already provide binary packages on researchgate. https://www.researchgate.net/project/Panel-Vector-Autoregression-Models-with-different-GMM-estimators
The binary panelvar package can be downloaded directly, I think sources should be available on CRAN in the near future. https://www.researchgate.net/publication/322526372_panelvar_044

- 213
- 2
- 10
-
1Link-only answers may become useless if link breaks (this really happens). You could expand your answer with presentation of major concepts from the paper, you link to. Or at least write 'check out `Panelvar` package. – Łukasz Deryło Jul 11 '17 at 08:50
-
Well, the package is not yet published anywhere, so I basically just wanted to add some references. Hope this is now enough. – hannes101 Jul 11 '17 at 08:53
-
2Yes, that's better. Now I can search for this paper even if your link breaks. Thanks! – Łukasz Deryło Jul 11 '17 at 09:00
-
The package `panelvar` is available on CRAN by now. Once installed and loaded, I would start at `?pvargmm` – altabq Jul 09 '19 at 14:38
Here you will find the R-package and the link to the paper.

- 131
- 1
- 2
-
I've created a parallelized version of the code to bootstrap the impulse response functions at https://github.com/hannes101/ParallelPanelVAR – hannes101 Apr 11 '18 at 08:31
Hi @Roman and every one else. I am also in panel VAR models and in my search, I came across this stata-based user-written commands pvar and xtvar. I have used pvar already and it seems quite okay. You can read more about it here, and a step-by-step application

- 11
- 1
-
here is the link to the pvar command and application: http://paneldataconference2015.ceu.hu/Program/Michael-Abrigo.pdf – Ayobami Jul 16 '17 at 15:40
-
1The OP asked for R code so I am not sure why you think Stata would be any help to him. Perhaps you can edit your answer to elaborate? – mdewey Jul 16 '17 at 16:16
I would suggest using the {vars}
library in R. It has a function for estimating a VAR-model and for estimating an impulse response function from this model and for investigating Granger causality etc.
I suggest you look into the following functions:
> VARselect()
> VAR()
> irf()
> causality()

- 132,789
- 81
- 357
- 650

- 1,216
- 10
- 21
-
thank you @fredrikhs for your comments. actually {vars} is good for time-series. how to use this package for the purpose of panels? direct applying doesn't work... – Rom Oct 17 '13 at 09:21
-
-
The data is in ordinary format as for the {plm} package purpose. Vars: ID country year REER GDP FinalConsumpExpend DimesticDemand ...(21 vars in total) over 1994Q1:2003Q1 period of time – Rom Oct 21 '13 at 05:23
-