Learn R Programming

egcm (version 1.0.8)

allpairs.egcm: Perform cointegration tests for all pairs of securities in a list

Description

Given a list of ticker symbols, downloads the adjusted daily closing prices of each of the symbols from Yahoo, and performs a cointegration test for each pair of symbols. Returns a data.frame containing the results of the tests.

Usage

allpairs.egcm(tickers, startdate = as.numeric(format(Sys.Date() - 365, "%Y%m%d")), enddate = as.numeric(format(Sys.Date(), "%Y%m%d")), ...)

Arguments

tickers
A list of ticker symbols whose data is to be downloaded from Yahoo!. Alternatively, this may be a data.frame containing the price series to be checked, one series per column.
startdate
The starting date for which to download the data. Given in the form YYYYMMDD. Defaults to one year ago.
enddate
The ending date for which to download the data. Given in the form YYYYMMDD. Defaults to today.
...
Other parameters to be passed to egcm

Value

A data.frame containing the following columns:
  • series1: Name of the first ticker in this cointegration test
  • series2: Name of the second ticker in this cointegration test
  • log: Boolean which if TRUE indicates that the cointegration test is performed on the logs of the series
  • i1test: Name of the test used for checking that the series are integrated.
  • urtest: Name of the test used for checking for a unit root in the residual series
  • alpha: Constant term of the linear relation between the series
  • alpha.se: Standard error of alpha
  • beta: Linear term of the linear relation between the series
  • beta.se: Standard error of beta
  • rho: Coefficient of mean reversion
  • rho.se: Standard error of rho
  • s1.i1.stat: Statistic computed for integration test of first series
  • s1.i1.p: p-value for integration test of first series
  • s2.i1.stat: Statistic computed for integration test of second series
  • s2.i1.p: p-value for integration test of second series
  • r.stat: Statistic computed for cointegration test (e.g. whether the residual series contains a unit root)
  • r.p: p-value associated with r.stat
  • eps.ljungbox.stat: Ljung-Box statistic computed on the innovations of the series
  • eps.ljungbox.p: p-value associated with the Ljung-Box statistic
  • s1.dsd: Standard deviation of the first differences of the first series
  • s2.dsd: Standard deviation of the first differences of the second series
  • residuals.sd: Standard deviation of the residual series
  • eps.sd: Standard deviation of the innovations
  • is.cointegrated: TRUE if the pair is cointegrated at the 5% confidence level

See Also

egcm

Examples

Run this code
## Not run: 
#     # Check if any of the oil majors are cointegrated:
#     allpairs.egcm(c("BP","CVX","RDS.A","TOT","XOM"))
# ## End(Not run)

Run the code above in your browser using DataLab