--- title: "URooTab: Tabular Reporting of 'EViews' Unit Root Tests" author: "Sagiru Mati, PhD" date: '`r format(Sys.Date(), "%A: %B %d, %Y")`' output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{URooTab: Tabular Reporting of 'EViews' Unit Root Tests} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", echo = T, eval=F, out.width = "45%", out.height = "20%", fig.show="hold" ) library(URooTab) library(knitr) ``` --> Please do not forget to cite the package as follows: **Plain text:** Mati S. (2023). URooTab: Tabular Reporting of 'EViews' Unit Root Tests. CRAN, https://github.com/sagirumati/URooTab **Bibtex:** @Manual{Mati2023, title = {{URooTab}: Tabular Reporting of {EViews} Unit Root Tests}, author = {Sagiru Mati}, publisher = {CRAN}, url = {https://github.com/sagirumati/URooTab}, } # 1 About the Author The author of this package, **Sagiru Mati**, obtained his PhD in Economics from the Near East University, North Cyprus. He works at the Department of Economics, Yusuf Maitama Sule (Northwest) University, Kano, Nigeria. Please visit his [website](https://smati.com.ng) for more details. Please follow his publications on: [**Google Scholar**](https://scholar.google.com/citations?user=odEp1eIAAAAJ&hl=en&oi=ao) [**Web of Science**](https://www.webofscience.com/wos/author/record/P-3408-2017) [**ORCID: 0000-0003-1413-3974**](https://orcid.org/0000-0003-1413-3974) # 2 About URooTab URooTab is an R package that can conducts `EViews` unit root tests and report them in tabular form. # 3 Why URooTab? While there are R packages and EViews add-ins available for presenting unit root tests in tabular form, none of them incorporates **EViews** procedures within the R environment. Specifically: - I wish I could conduct unit root using EViews routines in R, R Markdown or Quarto document - I wish I could dynamically import the results of the unit root tests individually or at once into R, R Markdown or Quarto document without switching between these applications back and forth. - I wish I could use an R function to report unit root test in a table style suitable for publication. - I wish I could automatically format the table in `Latex`, `html`, `pandoc` and `markdown`. - I wish I could do all of the above from R, R Markdown or Quarto without opening the EViews!!! # 4 Installation URooTab can be installed using the following commands in R. install.packages("URooTab") OR devtools::install_github("sagirumati/URooTab") # 5 Setup To run the package successfully, you need to do one of the following - Add EViews installation folder to path (**Environment Variables**). - Don’t do anything if the name of EViews executable is one of the following: `EViews13_x64`, `EViews13_x86`, `EViews12_x64`, `EViews12_x86`, `EViews11_x64`, `EViews11_x86`, `EViews10_x64`, `EViews10_x86`, `EViews9_x64`, `EViews9_x86`, `EViews10`. The package will find the executable automatically. - Rename the Eviews executable to `eviews` or one of the names above. - Alternatively, you can use `set_eviews_path()` function to set the path the EViews executable as follows: library(EviewR) set_eviews_path("C:/Program Files (x86)/EViews 10/EViews10.exe") # 6 Usage Please load the URooTab package as follows: ```{r} . library(URooTab) ``` # 7 Ways to use URooTab The package can work with base R, R Markdown or Quarto document. # 8 URooTab along with R Markdown or Quarto document You can use `URooTab` in an R chunk in R Markdown or Quarto document: The `uroot()` function reports all the available test (ADF and PP) at once. It is more suitable for Quarto document, which has both `tbl-cap` and `tbl-subcap` chunk options. To produce Table 8.1, use the R chunk below: Notice the chunk option `results: asis` because `uroot()` is designed to print all the tables (ADF and PP) in the chunk. If you are producing multiple `kable` tables, `results: asis` is necessary. You can also use `kableExtra` package to further customise the table. ```` ```{r}`r ''` #| label: URooTab #| eval: true #| results: asis library(URooTab) set.seed(1234) # for reproducibility x=rnorm(100) y=cumsum(x) z=cumsum(y) dataFrame=data.frame(x,y,z) uroot(dataFrame, caption = "Unit Root Tests for x, y and Z") ``` ````
Table 8.1: Unit Root Tests for x, y and Z
Variables None Constant Constant and trend None Constant Constant and trend Decision
X -8.300*** -8.396*** -8.815*** -8.274*** -8.239*** -8.214*** I(0)
Y 0.417 -1.907 0.026 -8.148*** -8.259*** -8.721*** I(1)
Z -2.379** -2.084 -2.938 0.417 -2.013 -0.033 I(2)
Table 8.1: Unit Root Tests for x, y and Z
Variables None Constant Constant and trend None Constant Constant and trend Decision
X -8.327*** -8.418*** -8.815*** -42.502*** -51.961*** -74.206*** I(0)
Y 0.275 -1.857 -0.066 -8.170*** -8.275*** -8.721*** I(1)
Z 6.659 3.450 -3.516** 0.274 -1.956 -0.109 I(2)
In R Markdown or Quarto document, `URooTab` is smart enough to recognise the document format and select the suitable table format. # 9 URooTab along with base R. In base R, you can get the table printed in console in the format you specify by the `format` argument. We can create a dataframe as follows: library(URooTab) set.seed(1234) # for reproducibility x = rnorm(100) y = cumsum(x) z = cumsum(y) dataFrame = data.frame(x, y, z) ## 9.1 The adf() function To print ADF test results in `latex` format: adf(dataFrame, format = "latex", info = "aic", caption = "ADF Unit Root Tests for x, y and Z") Or uroot(dataFrame, format = "latex", test = "adf", info = "aic", caption = "ADF Unit Root Tests for x, y and Z") The above code produces the following latex code: \begin{table}[h] \caption{ADF Unit Root Tests for x, y and Z} \centering \begin{tabular}[t]{llllllll} \toprule Variables & None & Constant & Constant and trend & None & Constant & Constant and trend & Decision\\ \midrule X & -8.300*** & -8.396*** & -8.815*** & -7.494*** & -7.460*** & -7.445*** & I(0)\\ Y & 0.224 & -1.934 & 0.026 & -8.148*** & -8.259*** & -8.721*** & I(1)\\ Z & -2.379** & -2.084 & -2.938 & 0.233 & -2.221 & -0.033 & I(2)\\ \bottomrule \end{tabular} \end{table} ## 9.2 The pp() function To print PP test results in `html` format: pp(dataFrame, format = "html", info = "aic", caption = "PP Unit Root Tests for x, y and Z") Or uroot(dataFrame, format = "html", info = "aic", test = "pp", caption = "PP Unit Root Tests for x, y and Z") The above code produces the following `html` codes in console:
PP Unit Root Tests for x, y and Z
Variables None Constant Constant and trend None Constant Constant and trend Decision
X -8.327*** -8.418*** -8.815*** -42.502*** -51.961*** -74.206*** I(0)
Y 0.275 -1.857 -0.066 -8.170*** -8.275*** -8.721*** I(1)
Z 6.659 3.450 -3.516** 0.274 -1.956 -0.109 I(2)
## 9.3 The uroot() function The `uroot()` function is a generic function that can be used to conduct any unit root test. Setting `test="adf"` conducts ADF test, while `test="pp"` conducts PP test. If `test` argument is not specified, the `uroot()` function conducts all the test at once.