Description Usage Arguments Value Author(s) Examples
View source: R/Cointegration.R
Check the stationarity of time series by Phillips-Perron Test for Unit Roots and Augmented Dickey-Fuller Test.
1 | IsStationary(spread, threshold)
|
spread |
checked time series object(xts) |
threshold |
threshhold value of p-value |
the vector which have the result of each test passed or not.
Shinichi Takayanagi, Kohta Ishikawa
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #load library
library(PairTrading)
#load sample stock price data
data(stock.price)
#select 2 stocks
price.pair <- stock.price[,1:2]["2008-12-31::"]
#Estimate parameters & plot spread
reg <- EstimateParameters(price.pair, method = lm)
#check stationarity
IsStationary(reg$spread, 0.1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.