1 About EviewsR

EviewsR is an R package that can run Eviews program from R Markdown.

2 Installation

EviewsR can be installed using the following commands in R.

install.packages("EviewsR")

          OR
          
devtools::install_github('sagirumati/EviewsR')

3 Setup

To run the package successfully, you need to allow Eviews program to run on Eviews startup. This can be set by clicking on options, General Options, window behaviour and ticking run program on Eviews startup as shown below:

4 Usage

Please load the EviewsR package as follows:

```{r EviewsR}                                                                .
library(EviewsR)
```

Then create a chunk for Eviews as shown below:

```{eviews EviewsR1,eval=T,echo=T,comment=NULL,results='hide'}                .
  'This program is created in R Markdown with the help of EviewsR package
  %path=@runpath
  cd %path
  wfcreate(page=EviewsR) EviewsR m 1999 2020
  for %y Created By Sagiru Mati Northwest University Kano Nigeria
  pagecreate(page={%y}) EviewsR m 1999 2020
  wfsave EviewsR
  next
  pageselect Sagiru
  genr y=rnd
  genr x=rnd
  equation ols.ls y c x
  freeze(EviewsR_OLS,mode=overwrite) ols
  EviewsR_OLS.save(t=csv, r=r7c1:r10c5) EviewsROLS
  EviewsR_OLS.save(t=csv) EviewsRtable
  freeze(EviewsR_Plot,mode=overwrite) y.line
  EviewsR_Plot.save(t=png) EviewsR_Plot_color
  EviewsR_Plot.save(t=png,-c) EviewsR_Plot_nocolor
  exit
```  

The above chunk creates an Eviews program with the chunk’s content, then automatically open Eviews and run the program, which will create an Eviews workfile with pages containing monthly sample from 1999 to 2020. The program will also save an Eviews workfile named EviewsR in the current directory.

We can dynamically and reproducibly fetch the Eviews graph object we created with the Eviews chunk using the following R chunk:

For the color graph object:

knitr::include_graphics("tools/EviewsR_Plot_color.png")
Eviews graph object with colour

Figure 4.1: Eviews graph object with colour





or the black and white graph object:

knitr::include_graphics("tools/EviewsR_Plot_nocolor.png")
Eviews graph object without colour

Figure 4.2: Eviews graph object without colour

we can also include the results of the OLS generated by the Eviews chunk using the following R chunk;

For the OLS result only:

olsResult=read.csv("tools/EviewsROLS.csv")
knitr::kable(olsResult)
Variable Coefficient Std..Error t.Statistic Prob.
NA NA NA NA
C 0.488464 0.035628 13.710250 0.0000
X 0.045118 0.061351 0.735409 0.4627





or the entire OLS output:

olsTable=read.csv("tools/EviewsRtable.csv")
knitr::kable(olsTable,format = "html")
Dependent.Variable..Y X X.1 X.2 X.3
Method: Least Squares
Date: 05/12/20 Time: 03:34
Sample: 1999M01 2020M12
Included observations: 264
Variable Coefficient Std. Error t-Statistic Prob.
C 0.488464 0.035628 13.71025 0.0000
X 0.045118 0.061351 0.735409 0.4627
R-squared 0.002060 Mean dependent var 0.511291
Adjusted R-squared -0.001749 S.D. dependent var 0.283882
S.E. of regression 0.284130 Akaike info criterion 0.328776
Sum squared resid 21.15121 Schwarz criterion 0.355867
Log likelihood -41.39848 Hannan-Quinn criter. 0.339662
F-statistic 0.540826 Durbin-Watson stat 1.828841
Prob(F-statistic) 0.462748





Please visit my Github for a better explanation and example files.