allpairs.egcm {egcm} | R Documentation |
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 = format(Sys.Date() - 365, "%Y-%m-%d"),
enddate = format(Sys.Date(), "%Y-%m-%d"), clear.na.inf=TRUE, ...)
Arguments
tickers |
A list of ticker symbols whose data is to be downloaded
from Yahoo!. Alternatively, this may be a |
startdate |
The starting date for which to download the data.
Given in the form |
enddate |
The ending date for which to download the data.
Given in the form |
clear.na.inf |
if TRUE, NA and Inf price values are replaced by the last available price. Default:TRUE. |
... |
Other parameters to be passed to |
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
Author(s)
Matthew Clegg matthewcleggphd@gmail.com
See Also
Examples
## Not run:
# Check if any of the oil majors are cointegrated:
allpairs.egcm(c("BP","CVX","RDS.A","TOT","XOM"))
## End(Not run)