Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
I. Introduction
This instruction describes how to implement the enclosed R programs to reproduce the results in Charles
Engel (2015), "Exchange Rates, Interest Rates, and the Risk Premium."
R is a free software environment for statistical computing and graphics, available from
http://www.r-project.org.
II. R installation
II.1 Install R for Windows.
Download installation file from:
http://cran.opensourceresources.org/bin/windows/base/R-2.12.1-win.exe
Follow installation instruction to install R.
http://cran.opensourceresources.org/bin/windows/base/README.R-2.12.1
We will assume the current working directory to be "C:\\R" in Windows operating system. Suppose we
set working directory
>setwd("C:\\R")
We need to install following packages: car, Biodem. sandwich, vars. Type the following command in R
console to install package to current working directory directly from CRAN:
>install.packages("car", "C:\\R")
>install.packages("Biodem","C:\\R")
>install.packages("zoo","C:\\R")
>install.packages("sandwich","C:\\R")
>install.packages("vars", "C:\\R")
Install the other packages with similar command.
Following the on-screen instructions to complete the package installation.
Type the following command in the console to set current working directory as the default library location.
>.libPaths("C:\\R")
First copy all program files and dataset files into current working directory.
Table 1
Table 2
Dataset
dat73_1.dat
dat73_1.dat
Program
fama_reg.R
cointegration.R
Output
Table1.csv
beta.true.cointegration.csv
beta.ci.cointegration.csv
Table 3
dat73_1.dat
Table345_VECM.R
Table3.coef.VECM.csv
Table3.ci.VECM.csv
Table 4
dat73_1.dat
Table345_VECM.R
Table4.coef.VECM.csv
Table4.ci.VECM.csv
Table 5
dat73_1.dat
Table345_VECM.R
Table5.coef.VECM.csv
Table5.ci.VECM.csv
Figure 1
dat73_1.dat
Figure1.R
fig1_VECM.CAN.csv
fig1_VECM.FRA.csv
fig1_VECM.DEU.csv
fig1_VECM.ITA.csv
fig1_VECM.JPN.csv
fig1_VECM.GBR.csv
fig1_VECM.G6.csv
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
dat73_1.dat
dat73_1.dat
dat73_1.dat
dat73_1.dat
dat73_New.
csv
dat73_1.dat
Figure2.R
Figure3.R
Figure4.R
Figure5.R
Figure6.R
fig2.G6.csv
fig3.G6.csv
fig4.G6.csv
fig5_VECM12.G6.csv
fig6_VECM_new.G6.csv
TableA1.R
dat73_1.dat
TableA3_biascorrection.
R
TableA3.R
A3_one_sided_bootstrap
A3_bootstrap_bootstrap
tabA1.CAN.csv
tabA1.FRA.csv
tabA1.DEU.csv
tabA1.ITA.csv
tabA1.JPN.csv
tabA1.GBR.csv
tabA1.G6.csv
tabA3.mean.median.biascorrection.csv
tabA3.mean.median.csv
Table
A1
Table
A3
Table
A4
NagelPhillpsPersistence.
m
SolvingCubicEquationsNagelPhillipsPersistence.
xls
>source("fama_reg.R")
The results are saved in the current working directory with name "Table1.csv." In the "Table1.csv," V1
refers to the point estimate of the intercept, and V2 and V3 indicate the lower and upper bound of its
confidence interval, respectively; V4 refers to the point estimate of the slope coefficient, and V5 and V6
indicate the lower and upper bound of its confidence interval, respectively.
>source("conintegration.R")
The point estimates of VECM parameters (g11, g21, and h1=g11-g21) and their Newey-West standard
errors are saved in beta.true.cointegration.csv, and the bootstrapped distribution of g11 , g21 , and g11g21 from VECM is saved in beta.ci.cointegration.csv.
>source("Table345_VECM.R")
The regression estimates and the Newey-West standard errors are saved in Table3.coef.VECM.csv. V1
and V2 refer to the intercept and the slop coefficient, respectively. Two bootstrapped confidence
intervalsa percentile interval and a percentile-t intervalare reported in Table3.ci.VECM.csv.
Similarly, the results for Table 4 and 5 are save in Table4.coef.VECM.csv, Table4.ci.VECM.csv,
Table5.coef.VECM.csv, and Table5.ci.VECM.csv.
>source("Figure1.R")
The estimates of the slope coefficient in ex ante excess return regressions and the lower and upper bounds
of their 90% confidence intervals are reported in Figure1_VECM.xxx.csv, where xxx refers to a
country abbreviation.
>source("Figure2.R")
The estimates of the slope coefficient in ex ante excess return regression for G6 and the lower and upper
bounds of their 90% confidence intervals are reported in fig2.G6.csv.
>source("Figure3.R")
The estimates of the slope coefficient in ex post excess return regression for G6 and the lower and upper
bounds of their 90% confidence intervals are reported in fig3.G6.csv.
>source("Figure4.R")
The estimates of the slope coefficient in ex post excess return regression for G6 and the lower and upper
bounds of their 90% confidence intervals are reported in fig4.G6.csv.
>source("Figure5.R")
The estimates of the slope coefficient in ex ante excess return regression (using the 12-lag VECM) for G6
and the lower and upper bounds of their 90% confidence intervals are reported in fig5_VECM12.G6.csv.
>source("Figure6.R")
The estimates of the slope coefficient in ex ante excess return regression (using the VECM augmented
with information variables) for G6 and the lower and upper bounds of their 90% confidence intervals are
reported in fig6_VECM_new.G6.csv.
>source("TableA1.R")
The coefficient estimates from VECMs are reported in tabA1.xxx.csv, where xxx refers to a country
abbreviation.
>source("TableA3_biascorrection.R")
>source("TableA3.R")
In tabA3.mean.median.biascorrection.csv, we save the estimated coefficients reported in Tables 3 and 5
and the mean and median estimate of these coefficients from the bootstraps, when bootstrap-afterbootstrap method is used to correct for possible bias in the estimated coefficients of the VECM. In
tabA3.mean.median.csv, we save the estimated coefficients reported in Tables 3 and 5 and the mean
and median estimate of these coefficients from the bootstraps, as we do not correct the bias in the
estimated coefficients of the VECM. To get the mean and median bias reported in A.3, subtract the results
in the second file from their counterparts in the first file.
To reproduce the table in A.4, type the following command in Matlab command window:
>
NagelPhillpsPersistence
and alter each parameter individually, leaving the others unchanged.
The simulation results are saved in SolvingCubicEquationsNagelPhillipsPersistence.xls.