Learn R Programming

egcm (version 1.0.8)

yegcm: Engle-Granger cointegration model from Yahoo! price series

Description

Fetches the Yahoo! price series for two securities and constructs an Engle-Granger cointegration model from them

Usage

yegcm(ticker1, ticker2, start = as.numeric(format(Sys.Date() - 365, "%Y%m%d")), end = as.numeric(format(Sys.Date(), "%Y%m%d")), ...)

Arguments

ticker1
the ticker symbol of the first security
ticker2
the ticker symbol of the second security
start
starting date, given in the format YYYYMMDD. Default: One year ago.
end
ending date, given in the format YYYYMMDD. Default: Today.
...
additional parameters passed to egcm

Value

An Engle-Granger cointegration model

Details

Uses the getYahooData function of the TTR package to retrieve the adjusted closing prices of the two securities over the specified date range. Then, constructs an Engle-Granger cointegration model from this data, and returns it.

References

Engle, R. F. and C. W. Granger. (1987) Co-integration and error correction: representation, estimation, and testing. Econometrica, 251-276.

See Also

egcm getYahooData

Examples

Run this code

e <- yegcm("SPY", "VOO", 20130101, 20140101)
print(e)
plot(e)
summary(e)

Run the code above in your browser using DataLab