Dear all,
This time, I will introduce you a new R package that I have been working on. I created it because since long time ago I was interested in VECM estimation in heterogeneous panels and I was not alone. In general, several researchers have shown their interest in this procedure. To my knowledge, this estimation cannot be done in any software without doing significant “engineering” using an statistical package or several of them. Just recently, I was requested by a reviewer to apply to use this methodology. I ended up combining Stata and Eviews for sure, and as far as I remember, Rstudio.
Due to this annoyance, I decided to create an R package for this procedure. The main theoretical body for Panel VECM in heterogeneous panels can be found in Pedroni (2019) and in Canning and Pedroni (2008). In these articles, the authors also propose long-run causality tests. My R package perform three of them. I called this package “pvecm” and it is hosted in GitHub. In order to use this package, you will only need to have installed the packages “base”, “cointReg”, “data.table”, “dplyr”, “dynlm”, “plm” and “stats”. However, to install it, it is important also to have installed “devtools”. Then, to install the package you should write in the console,
devtools::install_github("ReynaldoSenra/pvecm")
For a reason that I haven’t found, generally you will need to run this code to times in order to effectively install the “pvecm” package. To use it, you should not have any missing data in your variables and the indexes for the cross-sections should be integers which start with 1 and increase by 1. This package supports the inclusion of dummies in the short-run equations and stationary variables in the long-run equations if you estimate the cointegrated vector by Dynamic OLS (DOLS).
The package contains three functions. The main one is “pvecm” which estimates the Panel VECMS. Then, using objects created by the function “pvecm”, you can use “cause_pvecm” to apply three long-run causality tests proposed in the two articles that we mention in this post. For a detailed information about these causality tests, the reader is encouraged to read those articles. Indeed, it is worth to read the articles in order to grasp the whole theory behind VECM for heterogeneous panels and the corresponding causality tests.
Unfortunately, all this methodology require cross-sectional independence in our data. And we know that most of the panel data that we work with have significant cross-sectional dependence. One of the options to cope with this is to demean the data. I mention this because the “pvecm” don’t include any option to demean the data. Therefore, the data need to be demeaned beforehand. In a previous post, I explain how to do this and I prepared an small R code to demean the data. Therefore, you can visit that post and download the R code to demean the data before using the “pvecm” package. Finally, as usual, I prepared YouTube videos in English and Spanish to explain the use of the “pvecm” package to contribute to a better understanding of the package. I hope that you will find useful the “pvecm” package, this post and the YouTube videos. If you have any question, you can contact me with DM in Twitter: @ReynaldoSenra.
As this is a new package, I would be very grateful if any user contact me in case any bug is found. I will really appreciate that. Very much thank you in advance!